你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Azure Storage is a Microsoft managed service providing cloud storage that is highly available, secure, durable, scalable, and redundant. The following libraries in JavaScript make it easy to consume Azure Storage service.
Client Packages (12.X.X)
| Service | NPM package | Examples | Getting Started Guide |
|---|---|---|---|
| Storage Blob | @azure/storage-blob | storage-blob-typescript-examples storage-blob-JavaScript-examples |
Read and write objects and files from Azure Storage Blob |
| Storage Files | @azure/storage-file-share | storage-file-share-typescript-examples storage-file-share-javascript-examples |
|
| Storage Queue | @azure/storage-queue | storage-queue-typescript-examples storage-queue-JavaScript-examples |
Send and receive messages between cloud-connected applications with Azure Storage Queue |
Client Packages (2.X.X)
| Service | NPM package | Examples | Getting Started Guide |
|---|---|---|---|
| Storage Table | azure-storage (Legacy) |
- | Read and write large structured data with Azure Storage Table |
Install the npm module with npm install followed by the package-name. For example,
npm install @azure/storage-blob
and look at the examples from the links provided in the table above.
Read more about the client packages here - Azure Storage Client Libraries For JavaScript.
Find more getting started guides at Browse code samples
Management Package
Install the npm module
Install the Azure storage management npm module
npm install @azure/arm-storage
Example
Examples for using this module in Node.js as well as browser applications can be found in the README for the module
const msRestAzure = require('ms-rest-azure');
const storageManagementClient = require('azure-arm-storage');
const subscriptionId = 'your-subscription-id';
msRestAzure
.interactiveLogin()
.then(credentials => {
const client = new storageManagementClient(
credentials,
subscriptionId
);
return client.storageAccounts.list();
})
.then(accounts => console.dir(accounts, { depth: null, colors: true }))
.catch(err => console.log(err));