1. Tasks
  2. Extract Zip File

Tasks

Extract Zip File

Extracts the files inside a stored zip file and attaches each one to the stub. Useful for zip files received by email, WhatsApp, or any other ingestion route.

The zip file has to be in Stubber already, for example as an attachment from an incoming email or message. Each file inside the zip is uploaded to Stubber as its own file and attached to the stub, so it can be used by other tasks just like any other attachment.

INFO

The zip file itself is not removed from the stub. Use the Remove Attachment or Delete File task afterwards if it should not remain.

Uses

  • Use this to unpack a zip file that a customer sent by email or WhatsApp, so each document can be processed individually.
  • Use together with the Parse Data File task to read a CSV or Excel file that arrived inside a zip.

Basic usage

loading...

Parameters

fileuuid
required
string

The uuid of the zip file to extract.


max_files
optional
number

The maximum number of files allowed in the zip. If the zip contains more files, nothing is extracted and the task fails.
This can only lower the limit, not raise it.

Default: 100


max_total_size_mb
optional
number

The maximum total size of the files inside the zip, in MB, measured after extracting. If the files are larger, nothing is extracted and the task fails.
This can only lower the limit, not raise it.

Default: 100


file_creation_options
optional
object

Options applied to each extracted file when it is uploaded.

  • folder: The folder to place the extracted files in.
  • visibility: The visibility of the extracted files. Options: private public
  • lifecycle: When the extracted files should be archived or deleted, using archive and delete objects with after_creation_minutes or after_access_minutes.

How files are extracted

  • Filenames: Each file keeps its own name without the folders it was in. invoices/2024/invoice.pdf is attached as invoice.pdf.
  • Content type: The content type of each file is detected from its contents.
  • Skipped entries: Folders and system files created by macOS (__MACOSX/ and .DS_Store) are ignored.
  • Nested zip files: A zip file inside the zip is attached as a file. It is not extracted.
  • File extension policy: Each extracted file is checked against your organization's file extension policy, the same as any other upload. A file that is not allowed is skipped and listed in skipped, and the rest are still attached.

Result

loading...

Properties

attachments
array

The extracted files that were attached to the stub. Each item has a fileuuid, filename and contentType.


fileuuids
array

The uuids of the extracted files that were attached to the stub.


skipped
array

The files inside the zip that could not be uploaded. Each item has the name of the file inside the zip, including its folders, and the error that prevented it from being uploaded.


Errors

The task fails without extracting any files when:

  • fileuuid_required: The fileuuid parameter was not set.
  • zip_file_not_found: The file could not be found in your organization.
  • zip_file_unreadable: The file is not a valid zip file, or uses a format that cannot be read, such as password protection.
  • zip_file_too_many_files: The zip contains more files than max_files.
  • zip_file_too_large: The files inside the zip are larger than max_total_size_mb.

Examples

Extract into a folder with lower limits

Extracts at most 20 files, up to 10 MB in total, and places them in the imports folder.

loading...