Advanced Binary Data Handling and File Operations Guide - n8n Workflow

Comprehensive n8n workflow guide demonstrating how to manage and process binary data, including file uploads, image editing, and working with cloud storage in n8n templates.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Markdown-formatted:
Automation developers and n8n users who need to process files (images, documents) uploaded via forms.
Technical writers creating n8n templates that involve complex data manipulation.


  • Anyone seeking to understand binary data handling and conversion within an n8n workflow environment.

Overview

This comprehensive n8n workflow serves as a detailed tutorial and set of n8n templates for handling binary data across various services. Binary data—such as images, PDFs, or spreadsheets—requires specific handling within any n8n node. This guide addresses common challenges by providing several practical examples.

The core value is demonstrating how to access, manipulate, and transfer binary files. Key topics covered include: how to reference binary data from a previous n8n node using expressions (e.g., {{ $('NodeName').item.binary.binary_file }}), how to use the Set n8n node to assign binary data directly, and how to perform file operations like image information extraction and saving files to cloud storage like Google Drive.

How it Works

Markdown-formatted:
The n8n workflow is organized into several independent demonstration paths, illustrating different binary data operations.

Example 5: Assigning Binary Data in the Set n8n Node (Path 1)


  1. The workflow begins with an 'On form submission1' n8n trigger, which includes a file upload field (binaryfile).

  2. The next n8n node, 'Edit Fields', utilizes the new 'Binary' entry type in the Set node to pull the binary data from the trigger node and assign it to a new property named newimage.

  3. This newly assigned binary data is then passed to the 'Edit Fields1' Set n8n node, which assigns a string value for renaming purposes ('testers').

  4. The data is finally processed by the 'Edit Image' n8n node, which extracts metadata (like file dimensions or format) from the binary image file.

Example 7: Converting Data to Binary (Path 2)


  1. The 'When clicking ‘Execute workflow’' n8n trigger starts a path demonstrating how to convert Base64 or string representations of files back into binary data.

  2. The 'Edit Fields2' Set n8n node manually injects a Base64 string representing an image (as noted in the accompanying Sticky Note, this is typically obtained from API responses).

  3. The 'Convert to File2' n8n node uses the 'To Binary' operation, converting the Base64 string into a usable binary file for subsequent n8n node operations, like uploading to Google Drive.

Other Demonstrations (Separate Branches)

Image Analysis (Example 4): Binary data from the 'On form submission' n8n trigger is used by the 'Analyze an image' n8n node (Google Gemini) to describe the image content.
Data Extraction (Example 2 & 3): An 'Extract from File' n8n node (for XLSX) and an 'Extract text' n8n node (MistralAI) show how to parse data or extract text from binary document types (like spreadsheets or PDFs) received via triggers (like the 'Google Drive Trigger').

  • Cloud Operations (Example 6): Binary data received from the 'Google Drive Trigger' is prepared for saving via the 'FTP' n8n node, showcasing binary transfer to cloud storage endpoints.

Installation Guide

Markdown-formatted:


  1. Import the n8n Workflow: Copy the provided JSON data and import it directly into your n8n instance via the 'Workflows' menu, selecting 'New' and then 'Import from JSON'.

  2. Webhooks Setup: The 'On form submission1' and 'On form submission' n8n trigger nodes are configured with webhook URLs. Ensure these are active if you plan to test file uploads via web forms.

  3. Credential Configuration: Several n8n node types require credentials. You must set up or verify the following connections:

Google Drive: Required for 'Google Drive Trigger' and 'Upload file' nodes. This allows n8n to monitor a folder and write files to your Google Drive.
Mistral Cloud API: Required for the 'Extract text' n8n node (Mistral AI).
Google Gemini (PaLM) API: Required for the 'Analyze an image' n8n node.
FTP: Required for the 'FTP' n8n node if you test that branch of the n8n workflow.

  1. Testing: The simplest way to test the binary data handling is by using the 'On form submission1' n8n trigger to upload a test image and executing the workflow manually up to the 'Edit Image' n8n node.

Node Details

Markdown-formatted:

On form submission1 (n8n Trigger):
Function: Initiates the n8n workflow upon a file submission, capturing the uploaded binary file data.
Key Configuration: Field type is set to file with label binaryfile.

Edit Fields (Set n8n Node):
Function: Demonstrates how to access binary data from the previous n8n node using a specific expression and assign it to a new binary property (newimage).
Key Configuration: Assignment type is binary, value expression is ={{ $('On form submission1').item.binary.binaryfile }}.

Edit Image (Edit Image n8n Node):
Function: Processes the binary image data to extract basic information (e.g., width, height, format), proving that the binary data was correctly passed through the Set n8n node.
Key Configuration: Operation is information. Input data property is set by an expression referencing the newimage binary property.

Edit Fields2 (Set n8n Node):
Function: Manually creates a Base64 string representing an image (named image), simulating data often received from APIs. This data is the input for the subsequent conversion n8n node.
Key Configuration: Assignment type is string, containing Base64 image data.

Convert to File2 (Convert to File n8n Node):
Function: Converts the Base64 string input back into a functional binary file object, a crucial step for file uploads.
Key Configuration: Operation is toBinary, Source Property is image.

Upload file (Google Drive n8n Node):
Function: An example target n8n node demonstrating the final step of using processed binary data—uploading the file to a cloud service.

Analyze an image (Google Gemini n8n Node):
Function: Uses the Gemini model to analyze the contents of the uploaded binary image, showcasing AI capabilities working directly with binary input in an n8n node.
Key Configuration: Resource is image, Input Type is binary, Operation is analyze.

Related n8n Workflows

Free

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by

Featured*