n8n-docs/docs/nodes/nodes-library/core-nodes/MoveBinaryData
Harshil Agrawal 7b460243ab
SEO Update (#206)
2020-10-09 14:18:10 +02:00
..
HTTPRequest_node.png Move Binary Data 2020-09-11 20:32:19 +05:30
MoveBinaryData_node.png Move Binary Data 2020-09-11 20:32:19 +05:30
README.md SEO Update (#206) 2020-10-09 14:18:10 +02:00
workflow.png Move Binary Data 2020-09-11 20:32:19 +05:30
WriteBinaryFile_node.png Move Binary Data 2020-09-11 20:32:19 +05:30

permalink description
/nodes/n8n-nodes-base.moveBinaryData Learn how to use the Move Binary Data node in n8n

Move Binary Data

The Move Binary Data node is useful to move data between binary and JSON properties.

Node Reference

  • Mode: This field specifies from where and to the data should be moved.

    • Binary to JSON
    • JSON to Binary
  • Set all Data: If set to active, all JSON data is replaced with the data retrieved from binary key. If it is not set to active, the data will be written to a single key. This field is displayed when 'Binary to JSON' is selected from the Mode dropdown list.

  • Source Key: The name of the binary key to get data from. It is also possible to define deep keys by using dot-notation. For example, "level1.level2.currentKey". This field is displayed when 'Binary to JSON' is selected from the Mode dropdown list.

  • Destination Key: The name the JSON key to copy data to. It is also possible to define deep keys by using dot-notation. For example, "level1.level2.newKey". This field is displayed when 'Binary to JSON' is selected from the Mode dropdown list.

  • Convert all Data: If set to active all JSON data will be converted to binary. If it is not set to active only the data with one key will be converted. This field is displayed when 'JSON to Binary' is selected from the Mode dropdown list.

  • Destination Key: The name of the binary key to copy data to. It is also possible to define deep keys by using dot-notation. For example, "level1.level2.newKey". This field is displayed when 'JSON to Binary' is selected from the Mode dropdown list.

  • Options

    • Keep Source: Keep the source key. By default it gets deleted.
    • The following are the options when 'Binary to JSON' is selected from the Mode dropdown list.
      • Encoding: Set the encoding of the datastream.
      • JSON Parse: Run JSON parse on the data to get proper object data. This field is displayed when Set all Data is set to 'false'.
      • Keep As Base64: Keeps the binary data as base64 string. This field is displayed when Set all Data is set to 'false'.
    • The following are the options when 'JSON to Binary' is selected from the Mode dropdown list.
      • File Name: The file name to set.
      • Mime Type: The mime-type to set. By default the JSON mime-type will be set.
      • Use Raw Data: Use data as is and do not stringify it.
      • Data is Base64: Keeps the binary data as base64 string. This field is displayed when Convert all Data is set to 'false'.

Example Usage

This workflow allows you to store the JSON data received from the CocktailDB API to your machine. You can also find the workflow on n8n.io. This example usage workflow uses the following nodes.

The final workflow should look like the following image.

A workflow with the Move Binary Data node

1. Start node

The start node exists by default when you create a new workflow.

2. HTTP Request node (GET)

  1. Enter https://www.thecocktaildb.com/api/json/v1/1/random.php in the URL field.
  2. Click on Execute Node to run the node.

Get random cocktail data from CocktailDB API using the HTTP Request node

3. Move Binary Data node (JSON to Binary)

  1. Select 'JSON to Binary' from the Mode dropdown list.
  2. Click on Execute Node to run the node.

Convert JSON to binary using the Move Binary Data node

4. Write Binary File node

  1. Enter the file name in the File Name field.
  2. Click on Execute Node to run the node.

Writing a file to the disk using the Write Binary File node