You will find the following folders:
azure-storage-js-v10-quickstart-v10 - references Key Vault SDK v10.0
azure-storage-js-v10-quickstart-v12 - references Key Vault SDK v12.0
To use the latest Azure SDK version azure-storage-js-v10-quickstart-v12 please add the following dependency:
For the previous Azure SDK version azure-storage-js-v10-quickstart-v10 please add the following dependency:
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.
Resource group, create a new one and give it a unique name.
- Enter a name for your storage account.
- Select the
Locationto use for your Storage Account.
Account kindto StorageV2(general purpose v2).
Replicationto Locally-redundant storage (LRS).
Secure transfer requiredto 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.
Clone the repository on your machine:
git clone https://github.com/Azure-Samples/azure-storage-js-v10-quickstart.git
Then, switch to the appropriate folder "azure-storage-js-v10-quickstart-v10" or "azure-storage-js-v10-quickstart-v12":
Next, install the dependencies:
Finally, rename the file
.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:
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