How to stream blobs to Azure Blob Storage with Node.js

SDK Versions

In this sample, you will find the following folders:

  • v10 - references Storage Blob SDK v10
  • v12 - references Storage Blob SDK v12

Prerequisites

If you don't have a Microsoft Azure subscription, you can get a free account before you begin.

Clone the repository to your machine:

git clone https://github.com/Azure-Samples/azure-sdk-for-js-storage-blob-stream-nodejs.git

Then, switch to the appropriate folder:

cd v10

or

cd v12

Install dependencies via npm:

npm install

This Sample shows how to do following operations of Storage Blobs

  • Create a storage account.
  • Create a container.
  • Upload a stream to blockblob.

Adding your storage account name and key

Navigate to your storage account in the Azure Portal and copy the account name and key (under Settings > Access keys) into the .env.example file. Save the file and then rename it from .env.example to .env.

Running the sample

Start the server:

npm start

Navigate to http://localhost:3000 and upload an image to blob storage.

You can use the Azure Storage Explorer to view blob containers and verify your upload is successful.