I have a need to upload a file to my website from Node-RED so thought SFTP would be the way to do it.
I notice there's a few STFP nodes - anyone doing this and would recommend one of them?
I have a need to upload a file to my website from Node-RED so thought SFTP would be the way to do it.
I notice there's a few STFP nodes - anyone doing this and would recommend one of them?
Can you use rsync? You could do that via an exec node. The great advantage is that it will sync a complete directory if required, and that it only updates files that it needs to. If you setup ssh keys then you won't need to give it a password.
Hi Simon - I think I tried all the sFTP nodes and couldn't get any of them to work with my ISP.
In the end I wrote a Python script and called it from an 'exec' node in Node-RED.
That worked fine for me.
I want to have a file on my webserver called last.txt and I want to be able to update its contents.
So preferably, be able to specify the filename and contents to upload.
But at end of day, I can write the contents to a local copy of last.txt and then just upload it.
I've got node-red-contrib-sftp working doing this but just seeing if someone is using any of the other other contrib nodes that maybe allow the contents of a file to be specified as a msg parameter rather than having to do the file write and then upload
Using ssh you can, for example, run the command
echo 'Some Text' | ssh user@remotehost -T "cat > /path/remotefile.txt"
which will write "Some Text" to the file. In fact you should be able to write to the remote file in a similar way direct from stdin, but I would have to work out the command.
I've got a working solution - just wanted to see if anyone was actually using any of the sftp nodes as they are sparsely documented
There is a big difference between a working solution and one that gives you a warm glow when you sit back and see it work, and feel that you have got the right solution.
All the SFTP nodes seem a bit stale in development atm sadly.
I got GitHub - sublime93/node-red-contrib-better-sftp to work, but like all the other sftp nodes i have found the configuration seems to accept hardcodede values only. I have tried to use ${env} in the input fields to test if the functionality was implemented, but to no avail.
I have raise an issue on github for the node to be improved with the TypedInput Widget, but the repo has not been active for at couple of years..
Anyone up for a quick improvement ?
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.