Use this core logic n8n workflow to reliably change the file extension and associated MIME type of binary data passing through your n8n automation. Essential for consistent file processing.
Download this n8n workflow template and start using it instantly.
Automation Developers: Those building complex n8n workflows that handle file manipulation.
Integration Specialists: Users who need to ensure file integrity and correct MIME type headers when transferring files between different services (e.g., S3 to an API).
n8n Users: Anyone dealing with binary data where the source service provides an incorrect file extension or MIME classification.
Users looking for robust, reusable n8n templates for data transformation.
Mismatched file extensions or incorrect MIME types can often break integrations, especially when dealing with APIs that require strict file validation. This powerful utility n8n workflow solves this by providing a standardized method to take any incoming binary file and reconstruct it with a user-defined file extension and corresponding MIME type (e.g., ensuring a file is correctly treated as image/png instead of application/octet-stream). It acts as a reliable helper within larger n8n workflows, ensuring smooth and predictable file handling across your entire n8n automation pipeline.
This reusable n8n workflow is designed to be triggered either manually or as a sub-workflow call via the initial n8n trigger (Execute Workflow Trigger) which accepts binary data input.
SET OUTPUT FILE NAME n8n node. This node dynamically captures the name of the incoming binary property (binarykey) and allows the user to define the desired file name and extension (outputfile_name). This extension is the crucial piece of information used to determine the new MIME type.Extract from File n8n node converts the raw binary data into a Base64 text string. This is necessary because it allows the subsequent code step to easily manipulate the data within the standard JSON structure.Change Binary Data Type n8n node (a Code node). It reads the Base64 data, converts it back into a binary buffer, and then uses the n8n helper function this.helpers.prepareBinaryData. By providing the newly configured file name and extension during this preparation, the n8n node forces the binary object metadata to reflect the desired file type, completing the conversion.To utilize this functionality within your automation projects, follow these steps:
SET OUTPUT FILE NAME n8n node.outputfilename assignment. This value must include the desired file extension (e.g., image.png, document.pdf, song.mp3). The extension dictates the new MIME type recognized by subsequent n8n nodes.binarykey: The binarykey assignment uses an expression (={{ Object.keys($binary).first() }}) to automatically detect the incoming binary file name. Do not change this value.Once configured, this reusable logic can be integrated into your main n8n templates.
Change Binary MimeType/Extension (Execute Workflow Trigger n8n trigger):
Function: Serves as the starting point, typically used when calling this as a sub-workflow from another primary n8n workflow.
Key Configuration: Input Source set to 'Passthrough' to ensure incoming binary data is preserved.
SET OUTPUT FILE NAME (Set n8n node):
Function: Captures the unique binary property key and stores the user-defined output file name/extension.
Key Configuration: Defines outputfilename (e.g., audio.mp3) which controls the resulting MIME type, and dynamically sets binary_key using a variable expression.
Extract from File (n8n node):
Function: Converts the binary file stream into a Base64 encoded string property named data for easy manipulation in the next step.
Key Configuration: Operation set to 'Binary To Property'.
Change Binary Data Type (Code n8n node):
* Function: Executes the core logic. It reads the Base64 string, converts it back to a Buffer, and uses the n8n helper prepareBinaryData along with the configured file extension to recreate the binary object with the correct new MIME metadata. This is the heart of this n8n workflow logic.
Centralize your n8n error handling with this robust n8n workflow. Automatically configure error handlers, catch failures, and send detailed Gmail alerts for instant visibility across all your n8n projects.

Use this robust n8n workflow to automatically aggregate customer reviews from Trustpilot, Google, and Facebook APIs, normalize the data, and save it directly to Google Sheets for centralized reporting.

Deploy a robust, centralized error notification n8n workflow template. Receive instant alerts on Telegram, Slack, Gmail, or WhatsApp when any other n8n workflow fails.

Build an advanced n8n workflow using OpenAI Assistants, PostgreSQL memory, and external API calls (MySQL/HTTP). This n8n template manages context and retrieves real-time data.

Use this foundational n8n workflow to integrate diverse AI models, like Mistral, through OpenRouter.ai. Learn how to configure the n8n HTTP Request node for custom LLM automation.

This n8n workflow automates a full RAG system using Google Drive, OCR (Mistral AI), OpenAI embeddings, and Supabase vectors. Utilize these n8n templates to power a multi-channel AI chat agent across Slack, Telegram, and Gmail.

Innovative builder with a passion for crafting automation solutions that solve real-world challenges. From streamlining workflows to driving efficiency, my work empowers teams and individuals to achieve more with less effort. Experienced in developing scalable tools and strategies that deliver results with n8n, supabase and cline.







































