node-red-contrib-azure-blob-storage-aleph is a Node-RED node that allows you to work with Azure Blob Storage. You can create and delete Containers and also blob files. This projects comes from the discontinued repo Azure/node-red-contrib-azure
It contains tww Node-RED cloud nodes: Azure Save Blob Storage and Azure Get Bob Storage
Node-Red node to connect to Azure Blob Storage
Ex: 'msg.payload' -> filename that you need to upload. Ex: filename.txt
-
Use
msg.payload
to send a file to save on Azure Blob Storage. -
This file must be in the same folder of Node-RED user directory - typically
~/.node-red
npm install -g node-red-contrib-azure-blob-storage-aleph
{
payload: "file_existing_in_node_red.json"
}
Specifying blobname (accepts folder declaration)
{
payload: "file_existing_in_node_red.json",
blobName: "test/destination_blobname.json"
}
The node redirects input message
{
payload: "file_existing_in_node_red.json",
status: "OK",
_msgid: "bf03c891.604458"
}
Or with blobName
{
payload: "file_existing_in_node_red.json",
blobName: "test/destination_blobname.json",
status: "OK",
_msgid: "bf03c891.604458"
}
On Error
{
payload: "file_existing_in_node_red.json",
blobName: "test/destination_blobname.json",
status: "Error",
statusMessage: "Error: ENOENT: no such file or directory, stat 'file_existing_in_node_red.json'",
_msgid: "bf03c891.604458"
}
-
Open Node-RED, usually: http://127.0.0.1:1880
-
Go to Hamburger Menu -> Import -> Clipboard
-
Paste the following code into the "Import nodes" dialog
[{"id":"a7579ad9.74add8","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"ead7871a.8172c8","type":"inject","z":"a7579ad9.74add8","name":"Payload","props":[{"p":"payload.destinationFile","v":"DocumentTest.txt","vt":"str"},{"p":"payload.blobName","v":"some_file.txt","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","x":160,"y":160,"wires":[["c58e50c2.93222"]]},{"id":"fdab4f1f.0cab","type":"debug","z":"a7579ad9.74add8","name":"Log","active":true,"console":"false","complete":"true","x":570,"y":100,"wires":[]},{"id":"f65e9c4e.e7afb","type":"debug","z":"a7579ad9.74add8","name":"Log","active":true,"console":"false","complete":"true","x":570,"y":160,"wires":[]},{"id":"afe4baa5.276bc8","type":"Aleph Save Blob","z":"a7579ad9.74add8","name":"Azure Save Blob Storage","x":370,"y":100,"wires":[["fdab4f1f.0cab"]]},{"id":"c58e50c2.93222","type":"Aleph Get Blob","z":"a7579ad9.74add8","name":"Azure Get Blob Storage","x":370,"y":160,"wires":[["f65e9c4e.e7afb"]]},{"id":"e5858fae.8e3d6","type":"inject","z":"a7579ad9.74add8","name":"Payload","props":[{"p":"payload"},{"p":"blobName","v":"some_file.txt","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"./some_file_on_disk","payloadType":"str","x":160,"y":100,"wires":[["afe4baa5.276bc8"]]}] ``` 4. Double-click the Save Payload node
![](https://raw.githubusercontent.com/javis86/node-red-contrib-azure-blob-storage-aleph/main/images/save-payload.PNG)
-
Enter your filename into the Payload field and click Done. Check "Inject once at start?" to send that file when you click Deploy.
-
Double-click the Azure Save Blob Storage node, enter your Storage Account Name, Storage Account Key and your desired Container Name and Blob Name. Now click Done.
If you leave the Storage Blob name blank, the text in the msg.payload will be used as your blob name. Eg. if your msg.payload is
blob1.txt
, and the Storage Blob Name property is empty, the blob name will be assigned asblob1
-
Click Deploy
-
Click the square button on the left side of the Save Payload node.
-
Click on the debug tab to your right and you'll see the output confirming that your data was sent.
{
payload: {
destinationFile: "some_file.txt",
blobName: "test/some_file.txt"
}
}
The node redirects input message
{
_msgid: "d8f907b0c9a5fdf1"
payload: "blobs_downloaded/some_file.txt"
blobName: "test/some_file.txt"
status: "OK"
}
On Error
{
payload: "blobs_downloaded/some_file.txt"
blobName: "test/some_file.txt"
status: "Error"
statusMessage: "StorageError: NotFound"
_msgid: "bf03c891.604458"
}
-
Double-click the Get Payload node
-
Enter your filename into the Payload field and click Done.
-
Double-click the Azure Save Blob Storage node, enter your Storage Account Name, Storage Account Key and your desired Container Name and Blob Name. Now click Done.
-
Click Deploy
-
Click the square button on the left side of the Get Payload node.
-
Click on the debug tab to your right and you'll see the name of file that you just downloded to node-red local folder.
You can read more about Azure Storage here.