AutomationFlowsGeneral › Simple File Based Key Value Store Writekey

Simple File Based Key Value Store Writekey

Simple File Based Key Value Store Writekey. Uses manualTrigger, writeBinaryFile, functionItem, readBinaryFiles. Event-driven trigger; 10 nodes.

Event trigger★★★★☆ complexity10 nodesWrite Binary FileFunction ItemRead Binary FilesMove Binary Data
General Trigger: Event Nodes: 10 Complexity: ★★★★☆

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "name": "On clicking 'execute'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        60,
        300
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "name": "Write Binary File",
      "type": "n8n-nodes-base.writeBinaryFile",
      "position": [
        420,
        740
      ],
      "parameters": {
        "fileName": "={{$node[\"Config\"].json[\"file\"]}}",
        "dataPropertyName": "=data"
      },
      "typeVersion": 1
    },
    {
      "name": "Config",
      "type": "n8n-nodes-base.functionItem",
      "position": [
        600,
        300
      ],
      "parameters": {
        "functionCode": "return {\n  file: '/home/node/.n8n/local-files' + item.file,\n  key: item.key,\n  value: item.value\n}"
      },
      "typeVersion": 1
    },
    {
      "name": "Read Binary Files",
      "type": "n8n-nodes-base.readBinaryFiles",
      "position": [
        240,
        520
      ],
      "parameters": {
        "fileSelector": "={{$json[\"file\"]}}"
      },
      "typeVersion": 1,
      "continueOnFail": true,
      "alwaysOutputData": true
    },
    {
      "name": "SetKeyValue",
      "type": "n8n-nodes-base.functionItem",
      "position": [
        600,
        520
      ],
      "parameters": {
        "functionCode": "const key = $node[\"Config\"].json[\"key\"]\nconst value = $node[\"Config\"].json[\"value\"]\nitem[key] = value\n\nreturn item;"
      },
      "typeVersion": 1
    },
    {
      "name": "BinaryToJSON",
      "type": "n8n-nodes-base.moveBinaryData",
      "position": [
        420,
        520
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "name": "JSONToBinary",
      "type": "n8n-nodes-base.moveBinaryData",
      "position": [
        240,
        740
      ],
      "parameters": {
        "mode": "jsonToBinary",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        420,
        300
      ],
      "parameters": {
        "options": {},
        "batchSize": 1
      },
      "typeVersion": 1
    },
    {
      "name": "Repeat",
      "type": "n8n-nodes-base.if",
      "position": [
        600,
        740
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{$node[\"SplitInBatches\"].context[\"noItemsLeft\"]}}",
              "value2": true
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "name": "Done",
      "type": "n8n-nodes-base.functionItem",
      "position": [
        800,
        740
      ],
      "parameters": {
        "functionCode": "console.log('Done!');\n\nreturn item;"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Config": {
      "main": [
        [
          {
            "node": "Read Binary Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Repeat": {
      "main": [
        [
          {
            "node": "Done",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SetKeyValue": {
      "main": [
        [
          {
            "node": "JSONToBinary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BinaryToJSON": {
      "main": [
        [
          {
            "node": "SetKeyValue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JSONToBinary": {
      "main": [
        [
          {
            "node": "Write Binary File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Binary Files": {
      "main": [
        [
          {
            "node": "BinaryToJSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Binary File": {
      "main": [
        [
          {
            "node": "Repeat",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On clicking 'execute'": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

About this workflow

Simple File Based Key Value Store Writekey. Uses manualTrigger, writeBinaryFile, functionItem, readBinaryFiles. Event-driven trigger; 10 nodes.

Source: https://github.com/Zie619/n8n-workflows — original creator credit. Request a take-down →

More General workflows → · Browse all categories →