n8n-binary-and-data
Handle files and binary data in n8n correctly.
Skill by czlonkowski
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/czlonkowski-n8n-binary-and-data
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: documents, data, writing, agent-building, workflow-automation, document-processing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/n8n-binary-and-data
What's inside
- Skill name
n8n-binary-and-data- Description
- Handle files and binary data in n8n correctly. Use when working with files, images, PDFs, attachments, uploads or downloads, base64, vision/multimodal input, or when an AI agent needs a file as tool input or output — and whenever the user mentions $binary, binaryPropertyName, "read the PDF", "attach the file", "send the image", Merge losing binary, or a CDN for chat images. Covers the $binary vs $json split, reading/writing binary, keeping binary alive across transforms with Merge, the agent-tool binary boundary, and the CDN/URL requirement for chat surfaces.
- License
- MIT
- Instructions
- 246 lines in SKILL.md · view on GitHub
Files (6)
- AGENT_TOOL_BINARY.md
- BINARY_BASICS.md
- CDN_REQUIREMENT.md
- MERGE_FOR_CONTEXT.md
- README.md
- SKILL.md
SKILL.md (first lines)
# n8n Binary and Data
Every n8n item carries two independent slots: `$json` for structured data and `$binary` for file bytes. They travel side by side through the workflow. File contents — the actual PDF, image, or zip — live in `$binary`, never in `$json`. Get that split wrong and you read an empty field, lose a file mid-flow, or hand an AI agent a tool input it can't use.
This skill covers where binary lives, how to read and write it, how to keep it from being silently stripped, the hard wall between binary and the AI-agent tool boundary, and why chat surfaces need a URL instead of raw bytes.
---
## The three rules that prevent 90% of binary bugs
1. **File contents are in `$binary`, not `$json`.** After an HTTP download, a "Read Files", or an email-attachment trigger, the bytes sit in `$binary.<key>`. `$json` holds metadata at most. Reading `$json.data` for file contents gives you nothing.
2. **Binary cannot cross the AI-agent tool boundary — in either direction.** Tool arguments and tool return values are JSON only. An uploaded image can't be passed into a tool as a file, and a tool can't return raw bytes. Pre-stage to storage and pass a key or URL through JSON instead. See `AGENT_TOOL_BINARY.md`.
3. **Chat surfaces render images by URL, not by `$binary`.** Slack, Discord, Teams, Telegram, embedded webhook chat — none of them read the binary slot. The image has to live somewhere a URL can fetch it. See `CDN_REQUIREMENT.md`.
---
## The two slots
Each item is shaped like this:
```json
{
"json": { "customerId": 42, "status": "sent" },
"binary": {
"invoice": {
"data": "<base64-encoded bytes>",
"mimeType": "application/pdf",
"fileName": "invoice-42.pdf",
"fileExtension": "pdf"
}
}
}
```
The key inside `binary` (`invoice` here) is the **binary property name**. Most file-handling nodes have a `binaryPropertyName` parameter that points at it — the producer names the slot, the consumer references it by that name. The default key across most nodes is `data`, so when nothing tells you otherwise, assume `$binary.data`.
`$json` and `$binary` are separate namespaces. An expression like `{{ $binary.invoice.fileName }}` reads file metadata; `{{ $json.customerId }}` reads data. They never mix.
This split also explains a webhook gotcha: a Webhook trigger receiving `multipart/form-data` puts the uploaded file in `$binary` and the accompanying form fields in `$json.body` — so an uploaded file is not somewhere under `$json` at all. (The `$json.body` nesting for webhooks is **n8n-expression-syntax** territory.)
See `BINARY_BASICS.md` for the full slot anatomy, mime types, and size limits.
---
## Producing binary
You rarely build a `$binary` slot by hand — nodes populate it for you:
| Source | How binary appears |
|---|---|
| HTTP Request with `responseFormat: "file"` | Response body lands in `$binary.data` (or the name you set) |
| Read/Write Files from Disk | File contents read into `$binary` |
| Storage downloads (S3, Google Drive, Dropbox, etc.) | Downloaded file in `$binary.<key>` |
| Email triggers with attachments | Each attachment arrives in `$binary` |
| Provider AI media nodes (image/audio gen) | Set `options.binaryPropertyOutput` so the bytes land where the next node looks |
For an HTTP download, the one field that matters is `responseFormat`. Confirm it with `get_node` on `nodes-base.httpRequest` — leaving it as the default JSON/string format is the classic reason a downloaded file ends up as garbled text in `$json` instead of clean bytes in `$binary`.
---
## Reading and writing binary in a Code node
Most workflows never need to crack open the bytes — they just pass binary through to a consumer (email attachment, file upload, Slack file). Most byte jobs have a native node: **Extract From File** (CSV, XLSX, PDF text, JSON, plain text → items or a field), **Convert To File** (items → CSV / XLSX / JSON / text file), **Crypto** (hash a file with `binaryData: true`), **Compression** (zip / gzip). Read or write raw bytes in a Code node only when no node handles the format, with a `Why Code:` note.
**Read** with `getBinaryDataBuffer` — do not try to base64-decode `$binary.<key>.data` by hand:
```javascript
// Code node, "Run Once for Each Item"
const buffer = await this.helpers.getBinaryDataBuffer(0, 'data'); // (itemIndex, propertyName)
const text = buffer.toString('utf-8');
const length = buffer.length;
return [{
json: { ...$json, length },
binary: $input.item.binary, // pass the binary through, or it's gone
}];
```
**Write** by building the slot yourself — base64 the bytes plus a mime type and file name:
```javascript
const text = 'Hello, world!';
return [{
json: { ok: true },
binary: {
report: {
data: Buffer.from(text).toString('base64'),
mimeType: 'text/plain',
fileName: 'report.txt',
fileExtension: 'txt',
},
},
}];
```
The Code-node sandbox, helpers, and execution modes are the domain of **n8n-code-javascript** (and **n8n-code-python**) — use those for the language-level detail. The one binary-specific thing to remember here: a Code node that returns `[{ json: {...} }]` without re-attaching `binary` **silently drops the file**. See `BINARY_BASICS.md`.
---
## Keeping binary alive across transforms
JSON-only nodes — Edit Fields (Set), Code, IF, and others — can drop the `$binary` slot from their output. The workflow validates clean and runs without error; the file just isn't there downstream when the email node goes to attach it.
Two ways to keep it:
- **Pass-through option on the transforming node.** Edit Fields has `includeOtherFields`; a Code node can return `binary: $input.item.binary` explicitly. Cheapest fix when it's available.
- **Fan out and Merge by position.** Route the source into both the transform and a bypass branch, then recombine with a Merge in `combineByPosition` mode. The JSON comes from the transform side, the binary survives on the bypass side.
```
[Source with binary] ─┬─→ [Edit Fields: change JSON] ─┐
│ (binary stripped here) ├─→ [Merge: combineByPosition] ─→ [Email: attach]
└──────────────────────────────────┘
(bypass — binary passes through untouched)
```
`combineByPosition` pairs item N from each input, so the field counts must line up. The connection wiring and the alternatives for many-strip-point chains (upload-early, sub-workflow) are in `MERGE_FOR_CONTEXT.md`.From czlonkowski/n8n-skills, MIT.
More from czlonkowski/n8n-skills
- 0.848score
n8n-subworkflows
czlonkowski
Build reusable, composable n8n sub-workflows.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
n8n-self-hosting
czlonkowski
Deploy a production self-hosted n8n end-to-end to a fresh Linux VM over SSH, using Docker Compose behind a Caddy reverse proxy with automatic HTTPS.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
n8n-code-javascript
czlonkowski
Write, review, or debug JavaScript in an n8n Code node.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
n8n-error-handling
czlonkowski
Wire n8n error handling so failures are loud, structured, and recoverable.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
n8n-multi-instance
czlonkowski
Use when an n8n-mcp account targets more than one n8n instance — i.e.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
n8n-mcp-tools-expert
czlonkowski
Expert guide for using n8n-mcp MCP tools effectively.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
n8n-code-tool
czlonkowski
Write JavaScript or Python for the n8n Custom Code Tool (@n8n/n8n-nodes-langchain.toolCode) — the AI-agent-callable tool, NOT the workflow Code node.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
n8n-code-python
czlonkowski
Write Python in n8n Code nodes (native Python, `language` pythonNative, n8n 2.x).
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
n8n-agents
czlonkowski
Design n8n AI agents the right way.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
using-n8n-mcp-skills
czlonkowski
Use when building, editing, validating, testing, or debugging an n8n workflow through the n8n-mcp MCP server — designing a flow, configuring a node, writing…
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.838score
n8n-node-configuration
czlonkowski
Operation-aware node configuration guidance.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.838score
n8n-workflow-patterns
czlonkowski
Proven workflow architectural patterns from real n8n workflows.
SkillAFreshness: A★ 6.5KClaude Code +9
Compare and alternatives
Signals
- Stars
- 6,517
- Forks
- 1,075
- Open issues
- 10
- Last commit (this folder)
- Oct 24, 2026 (4 days ago)
- Last release
- Oct 24, 2026 (4 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/czlonkowski/n8n-skills
- Website
- www.n8n-skills.com
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from czlonkowski
- 0.848score
n8n-mcp-tools-expert
czlonkowski
Expert guide for using n8n-mcp MCP tools effectively.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
n8n-multi-instance
czlonkowski
Use when an n8n-mcp account targets more than one n8n instance — i.e.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
using-n8n-mcp-skills
czlonkowski
Use when building, editing, validating, testing, or debugging an n8n workflow through the n8n-mcp MCP server — designing a flow, configuring a node, writing…
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
n8n-subworkflows
czlonkowski
Build reusable, composable n8n sub-workflows.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
n8n-self-hosting
czlonkowski
Deploy a production self-hosted n8n end-to-end to a fresh Linux VM over SSH, using Docker Compose behind a Caddy reverse proxy with automatic HTTPS.
SkillAFreshness: A★ 6.5KClaude Code +9 - 0.848score
n8n-code-tool
czlonkowski
Write JavaScript or Python for the n8n Custom Code Tool (@n8n/n8n-nodes-langchain.toolCode) — the AI-agent-callable tool, NOT the workflow Code node.
SkillAFreshness: A★ 6.5KClaude Code +9
Cite this page
n8n-binary-and-data skill. Agent Mart. https://agentmart.dev/skills/czlonkowski-n8n-binary-and-data (last updated 2026-10-24)