Archive Decompression
Unpacks compressed archives into a structured array of files suitable for iteration with flow.split and downstream extraction nodes.
Unpacks one ZIP, TAR (gz/bz2) or 7z archive in a Python process and returns every file inside as base64, unpacking nested archives up to max_depth.
Supports the most common archive formats used for email attachments, data deliveries, and document exports, with recursive unpacking of nested archives up to a configurable depth.
Features:
- Supported formats: ZIP, TAR, TAR.GZ (tgz), TAR.BZ2 (tbz2), 7z. Format detection combines filename hints with magic bytes so mislabelled archives are still handled.
- Recursive unpacking: Nested archives (archive inside archive) are unpacked up to
max_depth, preserving full path context in each emitted file'sname. - MIME detection per entry: Every output file carries a normalized
content_typederived from its extension plus magic-byte sniffing so downstream dispatchers can route without extra probing. - Path traversal protection: Entries with
../or absolute paths are rejected to prevent Zip Slip attacks. - Encrypted / damaged entries: Entries that cannot be decompressed are skipped and reported in metadata rather than aborting the whole archive.
- Output shape: Array of
{ name, content_type, size, content_base64 }plus acountand per-entry metadata block.
How it works
- Reads
content_base64,file_pathandnamefrom the node config, falling back to the upstream payload. Fails onerrorwhen neithercontent_base64norfile_pathis present. - Chooses the format from the file name only:
namefor base64 input (defaultarchive), the base name offile_pathotherwise..zip,.tar,.tar.gz,.tgz,.tar.bz2and.7zare recognised; any other name is tried as ZIP and then as TAR. - Walks every regular file. Entries whose path is absolute or contains a
..segment are skipped and counted inmetadata.skipped_unsafe. - An entry whose name ends in an archive extension is unpacked recursively while its depth is below
max_depth(default 3); its files are named<parent>/<inner path>. If the nested archive cannot be opened, it is kept as a plain file. - Each file becomes
{ name, content_type, size, content_base64 };content_typeis guessed from the extension only (application/octet-streamwhen unknown). - Routes to
emptywhen no file was produced and toextractedotherwise.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-unpack-delivery",
"label": "Unpack delivery",
"operator_slug": "ai.archive.decompress",
"operator_version": "1.0.0",
"config": {
"content_base64": "{{ $json.attachment.content_base64 }}",
"name": "{{ $json.attachment.name }}",
"max_depth": 2,
"execution": {
"timeout_ms": 300000
}
}
}{
"ok": true,
"data": {
"files": [
{
"name": "invoices/2026-10.pdf",
"content_type": "application/pdf",
"size": 48213,
"content_base64": "JVBERi0xLjcK..."
}
],
"count": 1,
"empty": false,
"method": "zipfile",
"metadata": {
"max_depth_applied": 2,
"total_size_bytes": 48213,
"skipped_unsafe": 0
}
},
"port": "extracted"
}Configuration
-
max_depthnumber Optional -
Maximum depth of nested archive unpacking.
Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.
Behaviour in the code
What the implementation does with these keys beyond what the schema says.
-
content_base64, file_path, name - Not declared in the config schema, but read from the node config first and then from the upstream payload. Usually you map them from the previous node with expressions.
-
max_depth - Top-level entries are depth 0; a nested archive is opened only while its depth is below
max_depth. With0, nested archives are returned as files. -
execution - Only
execution.timeout_msis read (fallback 300000 ms).retryOnFail,maxTries,waitBetweenTries,continueOnFailandalwaysOutputDataare ignored.
Output ports
extracted default At least one file was unpacked.
{
"files": [
{
"name": "invoices/2026-10.pdf",
"content_type": "application/pdf",
"size": 48213,
"content_base64": "JVBERi0xLjcK..."
},
{
"name": "scans.zip/page-1.png",
"content_type": "image/png",
"size": 120044,
"content_base64": "iVBORw0KGgo..."
}
],
"count": 2,
"empty": false,
"method": "zipfile",
"metadata": {
"max_depth_applied": 3,
"total_size_bytes": 168257,
"skipped_unsafe": 0
}
}empty The archive opened but contained no usable file (only folders, or only unsafe entries).
{
"files": [],
"count": 0,
"empty": true,
"method": "zipfile",
"metadata": {
"max_depth_applied": 3,
"total_size_bytes": 0,
"skipped_unsafe": 1
}
}error No input was given, the archive could not be read (corrupt, encrypted, unsupported) or the script failed.
{
"error": "File is not a zip file",
"stderr": ""
}In expressions
What a later node can read from this node's output with $("Archive Decompression").item.json.<path> (write your node's label instead of Archive Decompression). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through extracted, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("Archive Decompression").item.json.files | ||
$("Archive Decompression").item.json.count | ||
$("Archive Decompression").item.json.empty | ||
$("Archive Decompression").item.json.method | ||
$("Archive Decompression").item.json.metadata | ||
$("Archive Decompression").item.json.metadata.max_depth_applied | — | |
$("Archive Decompression").item.json.metadata.total_size_bytes | — | |
$("Archive Decompression").item.json.metadata.skipped_unsafe | — |
— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).
Errors
| Message | Port | Cause and fix |
|---|---|---|
Either content_base64 or file_path is required. | error | Neither the node config nor the upstream payload carries the file. Map content_base64 (or file_path) from the previous node. |
Either content_base64 or file_path is required | error | Raised by the script (no trailing period) when only file_path was given and that file does not exist on the host. |
File <entry> is encrypted, password required for extraction | error | A password-protected ZIP entry stops the whole archive; entries are not skipped. Passwords are not supported. |
py7zr is not installed; cannot handle 7z archives | error | The 7z library is missing on the host. It is normally installed with the script's dependencies. |
<parser exception message> | error | The Python parser raised an exception (corrupt or unknown archive, e.g. a 7z sent without a .7z name). The message is passed through as data.error, with the script's stderr in data.stderr. |
Python timed out after <timeout_ms>ms | error | The script exceeded the node timeout. Raise execution.timeout_ms or send a smaller file. |
Python stdout exceeded MAX_STDOUT_BYTES (52428800 bytes) | error | The result (text or base64 files) is larger than the 50 MB cap. Split the input upstream. |
Python runtime not available (ENOENT) | error | The host has no Python interpreter. A failed dependency install shows PythonRunner failed: <message> instead. Both are host problems, not workflow problems. |
Input contract
-
content_base64string Optional -
file_pathstring Optional -
namestring Optional -
Optional archive filename hint (helps format detection).
Output contract
-
filesarray<object> Optional -
countnumber Optional -
emptyboolean Optional -
methodstring Optional -
metadataobject Optional
Contracts (JSON Schema)
The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.
{
"slug": "ai.archive.decompress",
"name": "Archive Decompression",
"category": "ai",
"version": "1.0.0",
"description": "Unpacks compressed archives into a structured array of files suitable for iteration with `flow.split` and downstream extraction nodes.\n\n Supports the most common archive formats used for email attachments, data deliveries, and document exports, with recursive unpacking of nested archives up to a configurable depth.\n\n **Features:**\n - **Supported formats:** ZIP, TAR, TAR.GZ (tgz), TAR.BZ2 (tbz2), 7z. Format detection combines filename hints with magic bytes so mislabelled archives are still handled.\n - **Recursive unpacking:** Nested archives (archive inside archive) are unpacked up to `max_depth`, preserving full path context in each emitted file's `name`.\n - **MIME detection per entry:** Every output file carries a normalized `content_type` derived from its extension plus magic-byte sniffing so downstream dispatchers can route without extra probing.\n - **Path traversal protection:** Entries with `../` or absolute paths are rejected to prevent Zip Slip attacks.\n - **Encrypted / damaged entries:** Entries that cannot be decompressed are skipped and reported in metadata rather than aborting the whole archive.\n - **Output shape:** Array of `{ name, content_type, size, content_base64 }` plus a `count` and per-entry metadata block.",
"capabilities": [
"archive",
"zip",
"tar",
"7z",
"decompression",
"recursion"
],
"config_schema": {
"type": "object",
"properties": {
"max_depth": {
"type": "number",
"title": "Max Recursion Depth",
"default": 3,
"description": "Maximum depth of nested archive unpacking."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
},
"input_contract_schema": {
"type": "object",
"properties": {
"content_base64": {
"type": "string"
},
"file_path": {
"type": "string"
},
"name": {
"type": "string",
"description": "Optional archive filename hint (helps format detection)."
}
}
},
"output_contract_schema": {
"type": "object",
"properties": {
"files": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"content_type": {
"type": "string"
},
"size": {
"type": "number"
},
"content_base64": {
"type": "string"
}
}
}
},
"count": {
"type": "number"
},
"empty": {
"type": "boolean"
},
"method": {
"type": "string"
},
"metadata": {
"type": "object"
}
}
},
"ports": [
{
"port_id": "extracted",
"label": "Extracted",
"is_default": true,
"supports_condition": true
},
{
"port_id": "empty",
"label": "Empty",
"is_default": false,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"is_default": false,
"supports_condition": false
}
],
"execution_mode": "async",
"tags": [
"ai",
"archive",
"zip",
"tar",
"decompress"
],
"is_stateful": false,
"publisher": {
"identity": "org_sommatic_ai",
"profile": {
"name": "Sommatic AI",
"verified": true,
"url": "https://me.veripass.com/sommatic",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"max_depth": {
"type": "number",
"title": "Max Recursion Depth",
"default": 3,
"description": "Maximum depth of nested archive unpacking."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
}{
"type": "object",
"properties": {
"content_base64": {
"type": "string"
},
"file_path": {
"type": "string"
},
"name": {
"type": "string",
"description": "Optional archive filename hint (helps format detection)."
}
}
}{
"type": "object",
"properties": {
"files": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"content_type": {
"type": "string"
},
"size": {
"type": "number"
},
"content_base64": {
"type": "string"
}
}
}
},
"count": {
"type": "number"
},
"empty": {
"type": "boolean"
},
"method": {
"type": "string"
},
"metadata": {
"type": "object"
}
}
}[
{
"port_id": "extracted",
"label": "Extracted",
"is_default": true,
"supports_condition": true
},
{
"port_id": "empty",
"label": "Empty",
"is_default": false,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"is_default": false,
"supports_condition": false
}
]Execution
- Execution
async- Stateful
- No
- Retries (
retryOnFail) - No
- Capabilities
archiveziptar7zdecompressionrecursion- Tags
aiarchiveziptardecompress
Notes and limits
- Runs a Python script in a child process. The first run on a worker host creates a virtual environment and installs the script's pinned dependencies (it can take minutes and is not counted in the node timeout); later runs reuse it.
file_pathmust point to a file on the local disk of the orchestrator host that runs the node; it is not a URL and is not fetched from storage.- The script is killed after
execution.timeout_ms; when that key is not set the code uses 300000 ms, not the schema default of 300000. - The script's JSON answer is capped at 50 MB (52428800 bytes, configurable on the host). Because files travel as base64, large inputs or outputs can hit this cap.
- At most 5000 files are returned; extra entries are dropped silently. There is no limit on the unpacked size other than the 50 MB output cap.
- Format and MIME detection use file names only, not magic bytes. Always pass
namewith the right extension for base64 input, especially for 7z. - Pair it with
flow.splitoverfilesto process each file downstream.
Reviewed against the orchestrator code · 31e874b · 2026-11-26