{
  "nodes": [
    {
      "id": "89bc61ce-8d29-403c-96d2-f1db4e7ad092",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        -592,
        352
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery",
        "binaryPropertyName": "={{ Object.keys($binary).first() }}"
      },
      "typeVersion": 1
    },
    {
      "id": "58ece6f1-fd56-4f4d-a1ca-49ea8062f5a3",
      "name": "SET OUTPUT FILE NAME",
      "type": "n8n-nodes-base.set",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        -976,
        352
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "db6b30b5-a420-430b-87ae-a4887bfe9628",
              "name": "binary_key",
              "type": "string",
              "value": "={{ Object.keys($binary).first() }}"
            },
            {
              "id": "8e1643f7-e794-43b2-a5ac-80b6b621b547",
              "name": "output_file_name",
              "type": "string",
              "value": "SET YOUR OUTPUT FILE NAME AND EXTENSION !! (ex: .mp3 or .png)"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "29b91d27-8a15-44e2-87fa-f431e9ad042d",
      "name": "Change Binary Data Type",
      "type": "n8n-nodes-base.code",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        -368,
        352
      ],
      "parameters": {
        "jsCode": "const myBuffer = Buffer.from($json.data, 'base64');\n\n$input.item.binary = {\n  [$('SET OUTPUT FILE NAME').last().json.binary_key]: await this.helpers.prepareBinaryData(myBuffer, $('SET OUTPUT FILE NAME').last().json.output_file_name)\n};\n\nreturn $input.item;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "224923e0-a967-42ff-b55a-b31720d54e8e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1136,
        16
      ],
      "parameters": {
        "color": 3,
        "width": 420,
        "height": 500,
        "content": "### \u2699\ufe0f CONFIGURE HERE \u2699\ufe0f\n\nThis is the main node you need to edit.\n\n1.  **`output_file_name`**: Change this value to the desired file name and extension. The extension is what determines the new MIME type.\n    *   **Example:** To convert to an MP3, set the value to `audio.mp3`.\n    *   **Example:** To ensure a file is treated as a PNG, set it to `image.png`.\n\n2.  **`binary_key`**: This field is dynamic and automatically finds the name of the incoming binary property. **Do not change this.**"
      },
      "typeVersion": 1
    },
    {
      "id": "cb424eb0-4779-4969-bbea-d994bc504761",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        96
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 420,
        "content": "### \u2699\ufe0f Core Logic (No Edit Needed)\n\nThese nodes work together to perform the conversion:\n\n1.  **Extract from File:** Converts the binary into text (Base64).\n2.  **Code:** Rebuilds the binary file using the new file name you provided in the previous step.\n\nThis process effectively changes the file's perceived format for other n8n nodes or external services."
      },
      "typeVersion": 1
    },
    {
      "id": "518b1531-fdb4-4ea6-9623-2b1982e15a43",
      "name": "Change Binary MimeType/Extension",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        -1344,
        352
      ],
      "parameters": {
        "inputSource": "passthrough"
      },
      "typeVersion": 1.1
    },
    {
      "id": "231fc258-e1d1-4a50-aa02-c40db76f42bf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -544
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 1056,
        "content": "## Was this helpful? Let me know!\n[![clic](https://supastudio.ia2s.app/storage/v1/object/public/assets/n8n/clic_down_lucas.gif)](https://workflows.ac/form)\n\nI really hope this tutorial helped you understand how to manipulate Binary data better. Your feedback is incredibly valuable and helps me create better resources for the n8n community.\n\n### **Have Feedback, a Question, or a Project Idea?**\n\n\n#### \u27a1\ufe0f **[Click here to go to the Contact Form](https://workflows.ac/form?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=change_binary_mime_type_extension&utm_content=5155)**\n\nUse this single link for anything you need:\n\n*   **Give Feedback:** Share your thoughts on this template, whether you found a typo, encountered an unexpected error, have a suggestion, or just want to say thanks!\n\n*   **Automation Coaching:** Get personalized, one-on-one guidance to master n8n. We can work together to help you reach an expert level.\n\n*   **Automation Consulting:** Have a complex business challenge or need custom workflows built from scratch? We offer a plug and play automation department for 8 to 88 people teams with unlimited automation requests.\n\n---\n\nHappy Automating!\nLucas Peyrin | [Workflows Accelerator](https://workflows.ac?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=change_binary_mime_type_extension&utm_content=5155)"
      },
      "typeVersion": 1
    },
    {
      "id": "fb0fa541-840b-4bdc-be0b-c8c4ac106de6",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1904,
        -144
      ],
      "parameters": {
        "width": 496,
        "height": 656,
        "content": "## \ud83d\udd04 Change Binary File Extension & MIME Type\n\nThis utility workflow solves the common headache of receiving files with generic extensions (like `.bin` or `.dat`) by forcing the correct filename and MIME type so your downstream apps process them correctly.\n\n**How it works:**\n*   **Define Output**: You simply specify the desired output filename and extension (e.g., change a generic file to `invoice.pdf` or `audio.mp3`) in the Set node.\n*   **Process Data**: The workflow temporarily converts the binary data into Base64 to handle the structure safely.\n*   **Rebuild**: It reconstructs the binary object with your new specific metadata, making it perfectly compatible with your next automation steps.\n\n---\n\n### Automate your operations today\nYour time is valuable. Let us automate the boring stuff for you.\n\n**\ud83d\udc47 CHOOSE YOUR PATH:**\n\n[ **\u26a1\ufe0f I WANT A FREE AUDIT (2 min)** ](https://workflows.ac/audit?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=change_binary_mime_type_extension&utm_content=5155)\n> *We've put our heart into this business evaluation machine.*\n\n[ **\ud83d\udca1 I HAVE A SPECIFIC REQUEST** ](https://workflows.ac/form?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=change_binary_mime_type_extension&utm_content=5155)"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Extract from File": {
      "main": [
        [
          {
            "node": "Change Binary Data Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SET OUTPUT FILE NAME": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Change Binary MimeType/Extension": {
      "main": [
        [
          {
            "node": "SET OUTPUT FILE NAME",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}