Hi everybody,
I am a newbie with Node-Red.
I have a flow that create a csv file starting from the data contained in a payload from an instrument, save the csv in the local machine with a custom name (xxxx_datetime.csv) and should send it to an FTP server.
My problem is that once the file is created, the file I receive at the FTP server is empty.
It looks like that the file I create is not closed or something, becuase if I try the flow putting to the FTP server a previosly created file, I have no problem.
Could anyone suggest me a solution?
I'm using node-red-contrib-ftp node
Assuming you are using the File Out node, did you see this comment in the info tab for the node " If msg.filename is used the file will be closed after every write"?
Hi Colin,
no, I did not see it.
I am using msg.filename to create the file, but I notice that is I use the same msg.filename ad msg.LocalFilename in the ftp node to identify the file to by sent, I have the problem I described above. This means that I have a function generating the msg.filename everytime I get a message from my instrument, and the same function populate the msg.localfilename for the ftp with a some seconds of delay.
Conversely, If I manually write the msg.LocalFilename directly in the ftp node, looking for an older file, I have no problem.
Any hint?
Sorry, I can't make sense of that post. For it to close the file you must use msg.filename to pass the name to the file node to tell it to close the file. If you think that is what you are doing then show us the output of a debug node showing what is going into the file node. Set the debug node to Show Complete Message.
Are you waiting for the file out node to complete before passing the message to the ftp node?
Hi Colin,
I think I solve the problem. As You pointed, the file is correctly close, but there was a wrong setting in the ftp node that was the reason for the empty file.
Thanks