Convert Multiple Binary Files to Base64 JSON Arrays with No Custom Code
No-Code: Convert Multiple Binary Files to Base64
Introduction
This template provides a robust, purely no-code solution for a common integration challenge: converting multiple binary files contained within a single n8n item (e.g., after unzipping an archive) into a structured JSON array of Base64 encoded strings.
Purpose
Many external APIs, especially those handling batch file uploads or complex data structures, require files to be submitted as a single JSON payload. This payload typically needs an array containing two elements for each file: the reconstructed file path/name and the Base64 encoded content. This template automatically handles the file isolation, encoding, path reconstruction, and final JSON aggregation, replacing the need for complex custom JavaScript Code nodes.
Configuration Steps
Input: Connect your binary data source (e.g., an HTTP Request followed by a Compression node) to the first node in this template. Split Out: This node automatically separates the multiple binary files into individual items. Extract From File: This node uses the dynamic expression {{ $binary.keys()[0] }} to ensure the correct binary file is targeted and converted to Base64. Set: This node uses a conditional expression to reconstruct the full path (including the directory, if present) for each file. Aggregate: The final node merges all individual items into a single, clean JSON item containing a top-level files array, ready for your final API call.
For a detailed walkthrough, including the explanation behind the dynamic expressions and why this is superior to the custom code solution, check out the full blog post: The No-Code Evolution: Base64 Encoding Multiple Files in n8n (Part 2).
Related Templates
Provide latest euro exchange rates from European Central Bank via Webhook
What is this workflow doing? This simple workflow is pulling the latest Euro foreign exchange reference rates from the E...
Automate Daily Keyword Research with Google Sheets, Suggest API & Custom Search
Who's it for This workflow is perfect for SEO specialists, marketers, bloggers, and content creators who want to automa...
USDT And TRC20 Wallet Tracker API Workflow for n8n
Overview This n8n workflow is specifically designed to monitor USDT TRC20 transactions within a specified wallet. It u...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments