Using the Azure Storage JavaScript SDK V10

This repository implements the Quickstart sample for the Azure Storage v10 SDK for JavaScript.

SDK Versions

You will find the following folders:

Prerequisites

Step 1 : Create a new general-purpose storage account to use for this tutorial.

  • Go to the Azure Portal and log in using your Azure account.
  • Select New > Storage > Storage account.
  • Select your Subscription.
  • For Resource group, create a new one and give it a unique name.
  • Enter a name for your storage account.
  • Select the Location to use for your Storage Account.
  • Set Account kind to StorageV2(general purpose v2).
  • Set Performance to Standard.
  • Set Replication to Locally-redundant storage (LRS).
  • Set Secure transfer required to Disabled.
  • Check Review + create and click Create to create your Storage Account.

Step 2 : Copy and save keys.

  • After your storage account is created, click on it to open it. Select Settings > Access keys > Key1, copy the associated Connection string to the clipboard, then paste it into a text editor for later use.

Set up

1.Clone

Clone the repository on your machine:

git clone https://github.com/Azure-Samples/azure-storage-js-v10-quickstart.git 

2.Switch Folder

Then, switch to the appropriate folder "azure-storage-js-v10-quickstart-v10" or "azure-storage-js-v10-quickstart-v12":

cd azure-storage-js-v10-quickstart-v10
cd azure-storage-js-v10-quickstart-v12

3.Install Dependencies

Next, install the dependencies:

npm install

Finally, rename the file .env.example to .env and add your values for AZURE_STORAGE_ACCOUNT_NAME by using the name of your storage account and AZURE_STORAGE_ACCOUNT_ACCESS_KEY which you had copied from key1 and pasted in the text editor earlier.

Running the sample

Execute the following command in a terminal to start the sample:

npm start

The output of this command will be the following:

Containers:
 - container-a
 - container-b
Container: "demo" is created
Blob "quickstart.txt" is uploaded
Local file "../readme.md" is uploaded
Blobs in "demo" container:
 - quickstart.txt
 - readme-stream.md
 - readme.md
Downloaded blob content: "Hello Node SDK"
Block blob "quickstart.txt" is deleted
Container "demo" is deleted
Done