Save payload in a local file, then set as output of the file node the name of the file and not the payload?

#1

I am trying to send data to the Azure Blob Storage service. In the future this data should be sent every 5 seconds but at the moment I am trying to keep it simple.

So, here is what I know (I am a beginner):

Part 1 : I know how to save a message.payload into a local file: Inject node and file node. The output of this is the message.payload.

Part 2: I know how to upload a local file into the Blob Storage: Inject node and Blob Storage node. The input should be the name of the file I want to upload.

As you can imagine, the problem is that the output of Part 1 is a message.payload and the input of Part 2 should be the name of the file and not the content of it, which is the message.payload. I believe there has to be a solution for this and I have been googling but haven't found anything since I think my problem is very specific. Maybe someone here has some advice for me.

So basically the question is, how do I get the name of the file that I am saving in Part 1 to be the message.payload right before Part 2 starts?

Thanks in advance! Cheers

0 Likes

#2

How are you setting the file name in the first place - if it is static then the simple method is probably the simplest :slight_smile:

Assuming you are passing in the filename in the msg.filename property or even if you have hard coded it in the node, it is passed through to the output connector as msg.filename.

[{"id":"c931c7bd.cc47f8","type":"inject","z":"63281c77.40a064","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":380,"wires":[["2942e866.56f8c8"]]},{"id":"2942e866.56f8c8","type":"change","z":"63281c77.40a064","name":"","rules":[{"t":"set","p":"filename","pt":"msg","to":"fred.txt","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":380,"wires":[["712e9923.4a5ef8"]]},{"id":"712e9923.4a5ef8","type":"file in","z":"63281c77.40a064","name":"","filename":"fred.txt","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":510,"y":380,"wires":[["5eb44e0e.51727"]]},{"id":"5eb44e0e.51727","type":"debug","z":"63281c77.40a064","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":380,"wires":[]}]
0 Likes

#3

The problem was that I had an old version of Node-RED. Ooops. Sorry if anyone wasted their time here :frowning:

0 Likes