Hello Zenofmud,
Sorry for not posting this earlier.
Here is the json file imported from a new flow.
Also. i have added similar flow for a simple png file in the same flow but too isnt working
[
{
"id": "8abafcc658f0c121",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "eb32e217d0e9ae25",
"type": "http response",
"z": "8abafcc658f0c121",
"name": "",
"statusCode": "200",
"headers": {},
"x": 840,
"y": 300,
"wires": []
},
{
"id": "53f429b72f9df214",
"type": "http in",
"z": "8abafcc658f0c121",
"name": "",
"url": "/lota_file",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 90,
"y": 360,
"wires": [
[
"2edb87c7d013cc50"
]
]
},
{
"id": "01fe28d777300a20",
"type": "function",
"z": "8abafcc658f0c121",
"name": "",
"func": "var msg_out={};\nvar file= msg.filename;\nnode.warn(file);\nmsg_out.headers = {\n\"Cache-Control\": \"no-cache\",\n\"Pragma\": \"no-cache\",\n//\"Content-Transfer-Encoding\": \"binary\",\n\"Content-Type\": \"text/html\",\n// \"Content-Disposition\": \"attachment;filename=\" + file,//.split(\"Home Automation\")[1],\n\"Content-Length\": \"\" + msg.payload.length\n};\nmsg_out.statusCode = 200;\nmsg_out.payload = Buffer.from(msg.payload);\nreturn msg_out;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 640,
"y": 360,
"wires": [
[
"eb32e217d0e9ae25",
"2740573fc2492528",
"289400e3c67f402c"
]
]
},
{
"id": "2740573fc2492528",
"type": "debug",
"z": "8abafcc658f0c121",
"name": "debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "headers",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 710,
"y": 480,
"wires": []
},
{
"id": "2edb87c7d013cc50",
"type": "file in",
"z": "8abafcc658f0c121",
"name": "Fetch OTA file",
"filename": "C:\\Users\\shariq\\.node-red\\house.png",
"filenameType": "str",
"format": "",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 380,
"y": 380,
"wires": [
[
"01fe28d777300a20"
]
]
},
{
"id": "289400e3c67f402c",
"type": "debug",
"z": "8abafcc658f0c121",
"name": "debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 830,
"y": 380,
"wires": []
},
{
"id": "f5cbe277a9ff9bf7",
"type": "http in",
"z": "8abafcc658f0c121",
"name": "",
"url": "/ota_file",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 110,
"y": 80,
"wires": [
[
"bd812664c4ddf70f"
]
]
},
{
"id": "fca5364d8e8a109a",
"type": "function",
"z": "8abafcc658f0c121",
"name": "",
"func": "var msg_out={};\nvar file= msg.file_name;\nnode.warn(file);\nmsg_out.headers = {\n\"Cache-Control\": \"no-cache\",\n\"Pragma\": \"no-cache\",\n\"Content-Transfer-Encoding\": \"binary\",\n\"Content-Type\": \"application/octet-stream\",\n\"Content-Disposition\": \"attachment;filename=\" + file,//.split(\"Home_otomation\")[1],\n\"Content-Length\": \"\" + msg.payload.length\n};\nmsg_out.statusCode = 200;\nmsg_out.payload = Buffer.from(msg.payload);\nreturn msg_out;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 660,
"y": 80,
"wires": [
[
"3da9edc8cbedb76a",
"b41823b25c74f657",
"bed3badedd5d4ea2"
]
]
},
{
"id": "3da9edc8cbedb76a",
"type": "debug",
"z": "8abafcc658f0c121",
"name": "debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "headers",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 200,
"wires": []
},
{
"id": "bd812664c4ddf70f",
"type": "file in",
"z": "8abafcc658f0c121",
"name": "Read FOTA info",
"filename": "D:\\Development\\Home_otomation\\fota.json",
"filenameType": "str",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 140,
"y": 140,
"wires": [
[
"b93f3b18aa9bb6e7"
]
]
},
{
"id": "b93f3b18aa9bb6e7",
"type": "json",
"z": "8abafcc658f0c121",
"name": "",
"property": "payload",
"action": "",
"pretty": true,
"x": 310,
"y": 100,
"wires": [
[
"abe1e9ce11532a60"
]
]
},
{
"id": "f6e9e10f46f1521e",
"type": "file in",
"z": "8abafcc658f0c121",
"name": "Fetch OTA file",
"filename": "file_name",
"filenameType": "msg",
"format": "",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 520,
"y": 140,
"wires": [
[
"fca5364d8e8a109a"
]
]
},
{
"id": "abe1e9ce11532a60",
"type": "function",
"z": "8abafcc658f0c121",
"name": "",
"func": "var file = \"D:\\\\Development\\\\Home_otomation\";\nvar bin= msg.payload.bin+\"\";\nbin = bin.replace('/', '\\\\');\n//node.warn(\"bin \" +bin);\nmsg.file_name = file + bin;\n//node.warn(\"bin2 \" + msg.file_name);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 340,
"y": 180,
"wires": [
[
"f6e9e10f46f1521e"
]
]
},
{
"id": "bed3badedd5d4ea2",
"type": "debug",
"z": "8abafcc658f0c121",
"name": "debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 850,
"y": 100,
"wires": []
},
{
"id": "b41823b25c74f657",
"type": "http response",
"z": "8abafcc658f0c121",
"name": "",
"statusCode": "200",
"headers": {},
"x": 860,
"y": 20,
"wires": []
}
]