azure-storage-node/browser
Xiaoning Liu d5c93fe1e5 Refactred test cases for browsers - drop key based cases from browser testing scope 2019-08-19 21:49:37 -07:00
..
samples Browser sample fixes 2018-10-08 19:04:31 -07:00
test Refactred test cases for browsers - drop key based cases from browser testing scope 2019-08-19 21:49:37 -07:00
ChangeLog.md 2.10.3 & 2.10.103 2019-03-27 16:33:22 +08:00
README.md Added JSv10 link; Added docs.microsoft.com link; Removed slack channel link 2018-09-28 00:19:10 -07:00
azure-storage.blob.export.js Added support for oauth 2018-05-28 16:59:03 +08:00
azure-storage.file.export.js Added support for JavaScript UMD module 2018-03-02 17:04:33 +08:00
azure-storage.queue.export.js Added support for oauth 2018-05-28 16:59:03 +08:00
azure-storage.table.export.js Added support for JavaScript UMD module 2018-03-02 17:04:33 +08:00
bundle.js Remove SharedKey auth & SAS generation from browser bundle 2019-08-19 21:49:37 -07:00

README.md

Azure Storage JavaScript Client Library for Browsers

Downloading

It's recommended to use the Azure Storage JavaScript Client Library provided by us. Please download the latest library.

There are 8 generated JavaScript files for Azure Storage JavaScript Client Library:

  • azure-storage.blob.js and azure-storage.blob.min.js contain the Azure Storage blob service operation logic
  • azure-storage.table.js and azure-storage.table.min.js contain the Azure Storage table service operation logic
  • azure-storage.queue.js and azure-storage.queue.min.js contain the Azure Storage queue service operation logic
  • azure-storage.file.js and azure-storage.file.min.js contain the Azure Storage file service operation logic

We also provide samples to guide you quickly start with the Azure Storage JavaScript Client Library. In the JavaScript Client Library zip file or following online links, you will find 4 HTML samples:

  • sample-blob.html demonstrates how to operate with Azure Storage blob service in the browser
  • sample-table.html demonstrates how to operate with Azure Storage table service in the browser
  • sample-queue.html demonstrates how to operate with Azure Storage queue service in the browser
  • sample-file.html demonstrates how to operate with Azure Storage file service in the browser

After generating the JavaScript Client Library, you can try the samples in browsers such as Chrome/Edge/Firefox directly.

Note: An HTTP server should be set to host the samples for IE11 and Chrome (56 or newer versions).

Or you can directly try with following online samples:

Module Support

Above JavaScript files are all UMD compatible. You can load them in a CommonJS or AMD environment by JavaScript module loaders. If no module system is found, following global variables will be set:

  • AzureStorage.Blob
  • AzureStorage.Table
  • AzureStorage.Queue
  • AzureStorage.File

Compatibility

Compatibility with mobile browsers have not been fully validated, please open issues when you get errors.

Running Tests against Browsers

Running tests against Chrome by default. The Storage Account should be configured with CORS support before running test. Please see above online samples about how to configure CORS rules for an account.

set AZURE_STORAGE_CONNECTION_STRING="valid storage connection string"
npm install
npm run jstest

Generating a Custom Azure Storage JavaScript Client Library

If you wish to customize the library and generate the Azure Storage JavaScript Client Library, you can follow the following steps.

We provide browserify bundle scripts which generate Azure Storage JavaScript Client Library. The bundle script reduces the size of the Storage Client Library by splitting into smaller files, one per storage service.

The generated JavaScript Client Library includes 8 separated JavaScript files:

  • azure-storage.blob.js
  • azure-storage.table.js
  • azure-storage.queue.js
  • azure-storage.file.js
  • azure-storage.blob.min.js
  • azure-storage.table.min.js
  • azure-storage.queue.min.js
  • azure-storage.file.min.js

Let's get started to generate the Azure Storage JavaScript Client Library!

Step 1: Cloning Repo

Azure Storage JavaScript Client Library is generated from Azure Storage SDK for Node.js. Clone azure-storage-node repo with following command:

git clone https://github.com/Azure/azure-storage-node.git

Step 2: Installing Node.js Modules

Change to the root directory of the cloned repo:

cd azure-storage-node

Install the dependent Node.js modules:

npm install

Step 3: Generating JavaScript Client Library with Bundle Scripts

We provide bundle scripts to help quickly generate the JavaScript Client Library. At the root directory of the cloned repo:

npm run genjs [VERSION_NUMBER]

Step 4: Finding the Generated JavaScript Files

If everything goes well, the generated JavaScript files should be saved to azure-storage-node/browser/bundle. There will be 8 generated JavaScript files totally:

  • azure-storage.blob.js
  • azure-storage.table.js
  • azure-storage.queue.js
  • azure-storage.file.js
  • azure-storage.blob.min.js
  • azure-storage.table.min.js
  • azure-storage.queue.min.js
  • azure-storage.file.min.js