n8n Compression Node: Zip, Gzip, and Decompress Files in Your Workflows [Free Workflow JSON]
The n8n Compression node lets you compress files into ZIP or GZIP archives and decompress them — all inside your workflow, with no external tools. Whether you're bundling reports for email attachments, reducing storage costs, or unpacking uploaded ZIPs to process their contents, the Compression node handles it natively.
This guide covers every operation, the binary data model, gotchas, and three production patterns with a free downloadable workflow JSON.
What the Compression Node Does
The Compression node works with binary data (files, not text strings). It has two operations:
| Operation | What It Does |
|---|---|
| Compress | Takes one or more binary items and packs them into a ZIP or GZIP archive |
| Decompress | Takes a ZIP or GZIP binary item and unpacks it into one or more binary items |
Operations
Compress
Parameters:
-
Input Binary Field: the field name holding your binary file(s) (default:
data) -
Output Format:
ziporgzip -
File Name: the output archive filename (e.g.
report.zip) -
Put Output in Field: field name for the resulting archive (default:
data)
GZIP vs ZIP:
-
GZIP compresses a single file. Use it for
report.csv.gz,export.json.gz, etc. - ZIP bundles multiple files into one archive. Use it when you need to email a folder of attachments or store a batch of processed files together.
Decompress
Parameters:
-
Input Binary Field: field name holding the archive (default:
data) -
Output Format:
ziporgzip - Output Prefix (ZIP only): string prepended to each extracted file's field name (default: empty)
When decompressing a ZIP, each file inside becomes a separate binary field on the item (e.g. file_0, file_1, file_2). You then loop over those fields to process each file.
Gotchas
| Issue | Cause | Fix |
|---|---|---|
| "Binary data not found" | Wrong input field name | Check upstream node's binary field name with a Debug node first |
ZIP extracts to file_0, file_1... |
Default behavior | Use Output Prefix to make field names clearer (e.g. extracted_) |
| GZIP on multi-file input | GZIP only supports single file | Use ZIP when compressing multiple binary items |
| Empty archive output | Input item has no binary data | Ensure the binary field is populated before compression |
| Can't loop over extracted files | Keys are dynamic (file_0…) |
Use a Code node to iterate Object.keys($binary)
|
| Large ZIP hangs workflow | Memory limit hit on big files | Split large ZIPs with Code node + stream if possible; for self-hosted increase memory limit |
Pattern 1: Compress a CSV Report and Email It as an Attachment
Use case: A scheduled workflow generates a CSV report and sends it as a .zip attachment to avoid size limits.
Schedule Trigger → Google Sheets (export) → Spreadsheet File (to CSV) → Compression (zip) → Gmail (attachment)
Compression node settings:
- Operation: Compress
- Input Binary Field:
data - Output Format:
zip - File Name:
weekly-report.zip
Gmail node: attach the data field from the Compression node output.
Pattern 2: Accept a ZIP Upload, Extract, and Process Each File
Use case: A webhook accepts a ZIP of uploaded documents. The workflow extracts every file and routes each one through a processing pipeline.
Webhook (receives ZIP) → Compression (decompress ZIP) → Code (loop over binary fields) → [process each file]
Compression node settings:
- Operation: Decompress
- Input Binary Field:
data - Output Format:
zip - Output Prefix:
doc_
Code node to iterate extracted files:
const binaryKeys = Object.keys($binary);
const items = binaryKeys.map(key => ({
json: { filename: $binary[key].fileName },
binary: { data: $binary[key] }
}));
return items;
This turns the multi-field binary item into separate items, one per file — ready for downstream processing.
Pattern 3: GZIP a Large JSON Export for S3 Storage
Use case: A nightly workflow exports a large JSON dataset from an API and stores it compressed in S3 to save storage costs.
Schedule Trigger → HTTP Request (API export) → Move Binary Data (JSON→binary) → Compression (gzip) → AWS S3 (upload)
Compression node settings:
- Operation: Compress
- Input Binary Field:
data - Output Format:
gzip - File Name:
export.json.gz
S3 node: set Content-Type to application/gzip.
Free Workflow JSON
Here's a ready-to-import workflow covering all three patterns. Copy it and import via n8n → Workflows → Import from JSON.
{
"name": "Compression Node – Zip, Gzip, and Decompress",
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [240, 300]
},
{
"parameters": {
"operation": "compress",
"binaryPropertyName": "data",
"outputFormat": "zip",
"fileName": "report.zip",
"binaryPropertyOutput": "data"
},
"name": "Compress to ZIP",
"type": "n8n-nodes-base.compression",
"typeVersion": 1,
"position": [460, 300]
},
{
"parameters": {
"operation": "decompress",
"binaryPropertyName": "data",
"outputFormat": "zip",
"outputPrefix": "doc_"
},
"name": "Decompress ZIP",
"type": "n8n-nodes-base.compression",
"typeVersion": 1,
"position": [460, 460]
},
{
"parameters": {
"operation": "compress",
"binaryPropertyName": "data",
"outputFormat": "gzip",
"fileName": "export.json.gz",
"binaryPropertyOutput": "data"
},
"name": "GZIP Export",
"type": "n8n-nodes-base.compression",
"typeVersion": 1,
"position": [460, 620]
}
],
"connections": {
"Start": {
"main": [[{"node": "Compress to ZIP", "type": "main", "index": 0}]]
}
}
}
Want More Ready-to-Use n8n Workflows?
The n8n Workflow Starter Pack includes 10 production-ready workflows covering the most common automation use cases — lead capture, Stripe fulfillment, scheduled reporting, and more. Each workflow is fully documented and importable in under a minute.
Get the n8n Workflow Starter Pack ($29) →
Questions about the Compression node? Drop them in the comments — especially if you're processing ZIPs at scale or hitting memory issues on large archives.
Top comments (1)
Are you using the Compression node to bundle reports for email or reduce storage costs on S3? Drop your use case below — curious whether ZIP vs GZIP preference varies by pipeline type.