How to read multiple binary files?

Hi, I want to read multiple .jpg files to send via HTTP request, and I couldn’t figure out how to pass multiple file paths in the “read binary files” node.

If you have multiple files and you do not know their names you can simply do something like this: test/*.jpg

In case you know the file-name (in this example 1.jpg and 2.jpg) this is possible: test/[1|2].jpg

Or you can also use the “Read Binary File” Node like in this example:

{
  "nodes": [
    {
      "parameters": {
        "filePath": "=test/{{$node[\"Function\"].json[\"name\"]}}"
      },
      "name": "Read Binary File",
      "type": "n8n-nodes-base.readBinaryFile",
      "typeVersion": 1,
      "position": [
        760,
        600
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {\n      name: '1.jpg'\n    }\n  },\n  {\n    json: {\n      name: '2.jpg'\n    }\n  }\n]"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        576,
        605
      ]
    }
  ],
  "connections": {
    "Function": {
      "main": [
        [
          {
            "node": "Read Binary File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
1 Like