Examples of downloading files from Azure Blob Storage

Kode picture Kode · Dec 18, 2015 · Viewed 7.6k times · Source

I am able to upload files to Azure blob storage via Node/Express without issue, but have found very minimal documentation/full examples of how to download a file. I found this on the tutorial page, but did not have any luck:

blobSvc.getBlobToStream('mycontainer', 'myblob', fs.createWriteStream('output.txt'), function(error, result, response){
  if(!error){
    // blob retrieved
  }
});

Has anyone else used node.js/express to download files from Azure blob storage? Did you use Azure, or another method (ex. Request). Could you share how to get a file from Azure and stream it to a folder?

Answer

Emily Gerner picture Emily Gerner · Dec 18, 2015

There's a full tutorial on using Azure Storage Blobs with Node.js here. The tutorial mentions getBlobToLocalFile which sounds like what you're probably looking for. The syntax for this method should be extremely similar to getBlobToStream but instead of a stream you'll provide a file path.