Reputation: 516
I want to download a file from Azure blob storage to Nodejs server file system,do some processing on that file on Nodejs side and upload the updated copy of file to the Blob storage again from the file system.
Please suggest some way/or anyone has implemented the same.
Thanks :)
Upvotes: 0
Views: 2671
Reputation: 150
Downloading a Blob using Node.js:
The following example demonstrates using getBlobToStream to download the contents of the myblob blob and store it to the output.txt file using a stream:
var fs = require('fs');
blobSvc.getBlobToStream('mycontainer', 'myblob', fs.createWriteStream('output.txt'), function(error, result, response){
if(!error){
// blob retrieved
}
});
Upload a file
How to: Upload a blob into a container
A blob can be either block, or page based. Block blobs allow you to more efficiently upload large data, while page blobs are optimized for read/write operations. For more information, see Understanding block blobs and page blobs.
Block blobs
To upload data to a block blob, use the following:
The following example uploads the contents of the test.txt file into myblob.
blobSvc.createBlockBlobFromLocalFile('mycontainer', 'myblob', 'test.txt', function(error, result, response){
if(!error){
// file uploaded
}
});
Upvotes: 2