Aller au contenu
Skillpedia
Programmation générale48k · #5267

n8n-binary-and-data

Ce qu’il fait

Cet outil vous aide à gérer les fichiers et les données binaires (comme des images ou des PDF) dans n8n. Il veille à ce que ces fichiers soient envoyés, reçus, transformés et transmis correctement, en les gardant séparés des données classiques (texte et nombres).

Quand l’utiliser

  • ✓Lorsque vous devez envoyer un fichier en pièce jointe d'un e-mail.
  • ✓Lorsque vous importez un fichier vers un service externe.
  • ✓Lorsqu'une image doit être affichée dans un chat.

Lien du skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/n8n-binary-and-data/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/n8n-binary-and-data/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Comment envoyer une image reçue dans un chat vers un service de stockage ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'outil sépare les données de fichiers (binaires) des données de texte et de nombres. Il veille à ce que les fichiers soient traités séparément et puissent être envoyés ou reçus correctement, même lorsqu'on utilise des fonctionnalités avancées comme les agents IA.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

n8n Binary and Data

When to Use

Use this skill when an n8n workflow reads, transforms, stores, uploads, downloads, or transmits files and binary fields, including multimodal agent inputs and chat attachments.

Treat uploaded files and generated URLs as potentially sensitive. Obtain approval before sending data to a new external host, use the narrowest retention and access scope available, avoid logging bytes or base64 payloads, and do not embed credentials in URLs or workflow fields.

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 references/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 references/CDN_REQUIREMENT.md.


The two slots

Each item is shaped like this:

{
  "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 references/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). When you do need the raw bytes, do it in a Code node.

Read with getBinaryDataBuffer — do not try to base64-decode $binary.<key>.data by hand:

// Code node, "Run Once for Each Item"

…
Questions fréquentes

Où les données du fichier sont-elles stockées ?

Le contenu du fichier (comme un PDF ou une image) se trouve dans un emplacement appelé « $binary », et non dans « $json », qui sert aux données classiques.

Puis-je envoyer directement un fichier à un outil d'IA ?

Non, les outils d'IA ne comprennent que le texte (JSON). Vous devez d'abord enregistrer le fichier, puis envoyer le lien (URL) à l'IA.

Pourquoi mes images ne s'affichent-elles pas dans le chat ?

Les chats ont besoin d'un lien (URL) pour afficher les images ; ils ne lisent pas les données brutes du fichier. Vous devez enregistrer l'image et fournir le lien.

Détails

Description originale de l’auteur

Handle n8n files and binary data across uploads, downloads, transforms, multimodal inputs, agent tools, and chat surfaces.

repo: sickn33/agentic-awesome-skills

Popularité

Étoiles GitHub
48k
Position au classement
#5267
Licence
MIT
Mis à jour
15/10/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires