Change Binary Mimetype/Extension
### How it works This workflow changes the file name, and therefore the extension and MIME type, of any binary file passed to it. This is perfect for converting file formats on the fly, like turning a Telegram voice message (`.oga`) into an MP3 for an AI transcription service. 1. **Set New File Name:** The `SET OUTPUT FILE NAME` node is where you define the desired output file name and extension (e.g., `audio.mp3`). It also dynamically captures the property name of the incoming binary (e.g., `data`). 2. **Extract Binary Data:** The workflow temporarily converts the binary file into a Base64 text string to make it accessible in the next step. 3. **Rebuild Binary with New Name:** A Code node takes the Base64 data and reconstructs it as a binary file, but this time, it assigns the new file name you specified. n8n automatically sets the MIME type based on the new file extension. ### Set up steps **Setup time: < 1 minute** This workflow is designed to be used as a sub-workflow. 1. In your main workflow, add an **Execute Sub-Workflow** node where you need to change a file's type. 2. In the **Workflow** parameter, select this Change Binary Mime Type/Extension workflow. 3. **Open this workflow** and go to the **`SET OUTPUT FILE NAME`** node. 4. Modify the `output_file_name` value to your desired file name (e.g., `voice_message.mp3` or `document.pdf`). 5. Save this workflow. Now, any binary file you send to it from your main workflow will be returned with the new file name and mime type.
How it works
This workflow changes the file name, and therefore the extension and MIME type, of any binary file passed to it. This is perfect for converting file formats on the fly, like turning a Telegram voice message (.oga) into an MP3 for an AI transcription service.
- Set New File Name: The
SET OUTPUT FILE NAMEnode is where you define the desired output file name and extension (e.g.,audio.mp3). It also dynamically captures the property name of the incoming binary (e.g.,data). - Extract Binary Data: The workflow temporarily converts the binary file into a Base64 text string to make it accessible in the next step.
- Rebuild Binary with New Name: A Code node takes the Base64 data and reconstructs it as a binary file, but this time, it assigns the new file name you specified. n8n automatically sets the MIME type based on the new file extension.
Set up steps
Setup time: < 1 minute
This workflow is designed to be used as a sub-workflow.
- In your main workflow, add an Execute Sub-Workflow node where you need to change a file's type.
- In the Workflow parameter, select this Change Binary Mime Type/Extension workflow.
- Open this workflow and go to the
SET OUTPUT FILE NAMEnode. - Modify the
output_file_namevalue to your desired file name (e.g.,voice_message.mp3ordocument.pdf). - Save this workflow. Now, any binary file you send to it from your main workflow will be returned with the new file name and mime type.
New buyers can create an account from the cart to unlock a controlled $10 first-purchase credit on eligible orders of $25+.
Secure checkout powered by Stripe
Support
How to import this workflow into n8n
- 1Purchase or download the workflow to get the n8n workflow JSON file.
- 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
- 3Open each node marked with a credential warning and connect your own accounts and API keys.
- 4Run the workflow once manually to verify the data flow, then toggle it to Active.
Related File & Document Management workflows
- Automate Invoice Data Extraction to Airtable with OCR and AI$14.99
- Save new Gmail attachments to Google Drive$3.99
- Automate PDF Invoice Creation from Google Sheets Using PDF.co$4.99
- Create Custom PDF Documents from Templates with Gemini & Google Drive$24.99
- Automatically Save and Organize Outlook Email Attachments in OneDrive Folders$9.99
- Automate Invoice Data Extraction from Google Drive to Google Sheets with Mistral OCR$14.99
More from Lucas Peyrin
Need this deployed? We'll set it up for you.
Our automation experts deploy this workflow in your stack, connect your accounts, and verify it works — or build a custom solution from scratch.