AutomationFlowsGeneral › Simple File Based Key Value Store Getkey

Simple File Based Key Value Store Getkey

Simple File Based Key Value Store Getkey. Uses manualTrigger, functionItem, readBinaryFile, moveBinaryData. Event-driven trigger; 5 nodes.

Event trigger★★★★☆ complexity5 nodesFunction ItemRead Binary FileMove Binary Data
General Trigger: Event Nodes: 5 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": [
        240,
        280
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "name": "Config",
      "type": "n8n-nodes-base.functionItem",
      "position": [
        420,
        280
      ],
      "parameters": {
        "functionCode": "return {\n  file: '/home/node/.n8n/local-files' + item.file,\n  key: item.key,\n  default: item.default\n}"
      },
      "typeVersion": 1
    },
    {
      "name": "Read Binary File",
      "type": "n8n-nodes-base.readBinaryFile",
      "position": [
        600,
        280
      ],
      "parameters": {
        "filePath": "={{$json[\"file\"]}}"
      },
      "typeVersion": 1,
      "continueOnFail": true,
      "alwaysOutputData": true
    },
    {
      "name": "BinaryToJSON",
      "type": "n8n-nodes-base.moveBinaryData",
      "position": [
        780,
        280
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "name": "ReturnValue",
      "type": "n8n-nodes-base.functionItem",
      "position": [
        960,
        280
      ],
      "parameters": {
        "functionCode": "const key = $node[\"Config\"].json[\"key\"]\nconst defaultValue = $node[\"Config\"].json[\"default\"]\n\nlet value\nif (item) {\n  value = item[key] || defaultValue\n} else {\n  value = defaultValue\n}\n\nreturn {\n  [ key ]: value\n}"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Config": {
      "main": [
        [
          {
            "node": "Read Binary File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BinaryToJSON": {
      "main": [
        [
          {
            "node": "ReturnValue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Binary File": {
      "main": [
        [
          {
            "node": "BinaryToJSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On clicking 'execute'": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

About this workflow

Simple File Based Key Value Store Getkey. Uses manualTrigger, functionItem, readBinaryFile, moveBinaryData. Event-driven trigger; 5 nodes.

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

More General workflows → · Browse all categories →