[
{
"id": "ee1ab1a1d7c8b3cd",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "08fb4ab344a08be7",
"type": "function",
"z": "ee1ab1a1d7c8b3cd",
"name": "",
"func": "const fs = msg.fs\n\nvar listFilesObject = msg.payload\nvar listFiles = []\nvar listFilesName = []\nvar listFilesDir = []\nfor (var lf = 0; lf < listFilesObject.length; lf++){\n listFiles.push(listFilesObject[lf].filename)\n listFilesName.push(listFilesObject[lf].file)\n listFilesDir.push(listFilesObject[lf].filedir)\n}\n\nvar readF = \"\"\n\nlistAddedObject = global.get('listAddedObject')\n\nfor (var i = 0; i < listAddedObject.length; i++){\n var nomeFile = listAddedObject[i]['CLIENTE'] + \".json\"\n if (listFilesName.includes(nomeFile)){\n var index = listFilesName.indexOf(nomeFile)\n read = fs.readFileSync(\"/volume1/ManagerSoftwares/nodeRedGestioneCommesse/database/1 Dakota.json\" ,'utf8').toString()\n node.warn(read)\n //readJson = JSON.parse(read)\n } else {\n fs.writeFile(\"/volume1/ManagerSoftwares/nodeRedGestioneCommesse/database/\" + nomeFile, \"ciao\")\n }\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 680,
"y": 240,
"wires": [
[]
]
},
{
"id": "dfdb27d2e66ea5c7",
"type": "ui_button",
"z": "ee1ab1a1d7c8b3cd",
"name": "",
"group": "f85672857eb8d277",
"order": 11,
"width": 0,
"height": 0,
"passthru": true,
"label": "SAVE",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 330,
"y": 200,
"wires": [
[
"52f183534952c516",
"8a16e379919fe4f7"
]
]
},
{
"id": "8a16e379919fe4f7",
"type": "glob",
"z": "ee1ab1a1d7c8b3cd",
"name": "LIST FILES",
"pattern": "*.json",
"patternType": "str",
"path": "/volume1/ManagerSoftwares/nodeRedGestioneCommesse/database",
"pathType": "str",
"property": "payload",
"output": "array",
"includeDirs": false,
"x": 490,
"y": 200,
"wires": [
[
"08fb4ab344a08be7"
]
]
},
{
"id": "52f183534952c516",
"type": "require",
"z": "ee1ab1a1d7c8b3cd",
"name": "fs",
"module": "fs",
"field": "fs",
"fieldType": "msg",
"x": 490,
"y": 260,
"wires": [
[
"08fb4ab344a08be7"
]
]
},
{
"id": "45293f863fdf50df",
"type": "inject",
"z": "ee1ab1a1d7c8b3cd",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 180,
"y": 200,
"wires": [
[
"dfdb27d2e66ea5c7"
]
]
},
{
"id": "f85672857eb8d277",
"type": "ui_group",
"name": "",
"tab": "2613143ac70eb817",
"order": 1,
"disp": false,
"width": "10",
"collapse": false,
"className": ""
},
{
"id": "2613143ac70eb817",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]