Storage Blobs Quickstart

WARNING You are viewing a tutorial for the legacy version of the Azure Storage Node.js SDK. Please go here to view the latest JavaScript SDK (v10).

The following sample includes the following features:

  • Uses async/await: The Azure Storage SDK API is still callback-based, but the approach in this sample modernizes the syntax. API calls are wrapped in Promises and are executed in the context of an async/await operation.

  • Uses environment variables: This sample accesses the connection string from an environment variable. The use of environment variables is representative of how you would access sensitive information in production.

To run this sample, you need an Azure account, a blob storage account, and the associated blob storage connection string.

Set up

First, clone the repository on your machine:

git clone

Then, switch to the appropriate folder:

cd storage-blobs-node-quickstart

Next, install the dependencies:

npm install

Now, add your blob storage connection string as an environment variable named AZURE_STORAGE_CONNECTION_STRING to a file named .env.

Note: This repository includes a file named .env.example. You can rename this file by removing .example and adding the correct value for your connection string in the .env file.

Running the sample

Once the setup, you can run the sample by using npm start.

npm start

When complete, the application should produce output similar to the following:

 - container-one
 - container-two
Container "demo" is created
Blob "quickstart.txt" is uploaded
Local file "./" is uploaded
Blobs in "demo" container:
 - quickstart.txt
Blob downloaded blob content: "hello Blob SDK"
Blob "quickstart.txt" is deleted
Container "demo" is deleted


You can use the Azure Storage explorer to see the data in your Azure account.