-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write to file? #1
Comments
Hello, |
Try a flow like that (only for text/ascii data): [
{
"id": "369592db.ff3c3e",
"type": "ui_upload",
"z": "2cb23187.5e68de",
"group": "d8ea40a9.7243d8",
"title": "upload",
"name": "",
"order": 0,
"width": 0,
"height": 5,
"chunk": 256,
"transfer": "binary",
"x": 310,
"y": 380,
"wires": [
[
"3f03e074.34b688"
]
]
},
{
"id": "3f03e074.34b688",
"type": "file",
"z": "2cb23187.5e68de",
"name": "",
"filename": "/tmp/test.txt",
"appendNewline": false,
"createDir": true,
"overwriteFile": "false",
"encoding": "none",
"x": 470,
"y": 380,
"wires": [
[
"57939435.f397c4"
]
]
},
{
"id": "57939435.f397c4",
"type": "function",
"z": "2cb23187.5e68de",
"name": "Ready for next lines",
"func": "return { tick: true };",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 680,
"y": 380,
"wires": [
[
"369592db.ff3c3e"
]
]
},
{
"id": "d8ea40a9.7243d8",
"type": "ui_group",
"name": "Default",
"tab": "909f2fda.b7e17",
"order": 1,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "909f2fda.b7e17",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
] I am considering doing |
Here is a better example with automatic filename: [
{
"id": "369592db.ff3c3e",
"type": "ui_upload",
"z": "2cb23187.5e68de",
"group": "d8ea40a9.7243d8",
"title": "upload",
"name": "",
"order": 0,
"width": 0,
"height": 5,
"chunk": 256,
"transfer": "binary",
"x": 310,
"y": 380,
"wires": [
[
"8131c214.ad0408"
]
]
},
{
"id": "3f03e074.34b688",
"type": "file",
"z": "2cb23187.5e68de",
"name": "",
"filename": "",
"appendNewline": false,
"createDir": true,
"overwriteFile": "false",
"encoding": "none",
"x": 610,
"y": 380,
"wires": [
[
"57939435.f397c4"
]
]
},
{
"id": "57939435.f397c4",
"type": "function",
"z": "2cb23187.5e68de",
"name": "Ready for next lines",
"func": "return { tick: true };",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 800,
"y": 380,
"wires": [
[
"369592db.ff3c3e"
]
]
},
{
"id": "8131c214.ad0408",
"type": "function",
"z": "2cb23187.5e68de",
"name": "Filename",
"func": "let filename = msg.file.name || 'tmp.txt';\nfilename = filename.replace(/[/\\\\]]/g, '_');\nmsg.filename = '/tmp/upload/' + msg.file.name;\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 460,
"y": 380,
"wires": [
[
"3f03e074.34b688"
]
]
},
{
"id": "d8ea40a9.7243d8",
"type": "ui_group",
"name": "Default",
"tab": "909f2fda.b7e17",
"order": 1,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "909f2fda.b7e17",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
] |
Hi @Alkarex , i used your last flow to upload files and write them to disk. Nice greetings |
@sniicker Try to reduce a bit the chunk size in the parameters. Slower values should be more reliable but slower. |
Is it possible to write the upload file to disk? I tried with the file node in append mode, but it truncate the end of the file :(
The text was updated successfully, but these errors were encountered: