azure-storage
Advanced tools
Comparing version 2.8.0 to 2.8.1
@@ -17,5 +17,3 @@ // | ||
var AzureStorage = window.AzureStorage || {}; | ||
AzureStorage.generateDevelopmentStorageCredentials = function (proxyUri) { | ||
module.exports.generateDevelopmentStorageCredentials = function (proxyUri) { | ||
var devStore = 'UseDevelopmentStorage=true;'; | ||
@@ -31,14 +29,14 @@ if(proxyUri){ | ||
AzureStorage.BlobService = BlobService; | ||
AzureStorage.BlobUtilities = require('../lib/services/blob/blobutilities'); | ||
module.exports.BlobService = BlobService; | ||
module.exports.BlobUtilities = require('../lib/services/blob/blobutilities'); | ||
AzureStorage.createBlobService = function (storageAccountOrConnectionString, storageAccessKey, host) { | ||
module.exports.createBlobService = function (storageAccountOrConnectionString, storageAccessKey, host) { | ||
return new BlobService(storageAccountOrConnectionString, storageAccessKey, host, null); | ||
}; | ||
AzureStorage.createBlobServiceWithSas = function (host, sasToken) { | ||
module.exports.createBlobServiceWithSas = function (host, sasToken) { | ||
return new BlobService(null, null, host, sasToken); | ||
}; | ||
AzureStorage.createBlobServiceAnonymous = function (host) { | ||
module.exports.createBlobServiceAnonymous = function (host) { | ||
return new BlobService(null, null, host, null); | ||
@@ -51,3 +49,3 @@ }; | ||
AzureStorage.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy) | ||
module.exports.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy) | ||
{ | ||
@@ -60,18 +58,16 @@ var storageSettings = StorageServiceClient.getStorageSettings(storageAccountOrConnectionString, storageAccessKey); | ||
AzureStorage.Constants = azureCommon.Constants; | ||
AzureStorage.StorageUtilities = azureCommon.StorageUtilities; | ||
AzureStorage.AccessCondition = azureCommon.AccessCondition; | ||
module.exports.Constants = azureCommon.Constants; | ||
module.exports.StorageUtilities = azureCommon.StorageUtilities; | ||
module.exports.AccessCondition = azureCommon.AccessCondition; | ||
AzureStorage.SR = azureCommon.SR; | ||
AzureStorage.StorageServiceClient = StorageServiceClient; | ||
AzureStorage.Logger = azureCommon.Logger; | ||
AzureStorage.WebResource = azureCommon.WebResource; | ||
AzureStorage.Validate = azureCommon.validate; | ||
AzureStorage.date = azureCommon.date; | ||
module.exports.SR = azureCommon.SR; | ||
module.exports.StorageServiceClient = StorageServiceClient; | ||
module.exports.Logger = azureCommon.Logger; | ||
module.exports.WebResource = azureCommon.WebResource; | ||
module.exports.Validate = azureCommon.validate; | ||
module.exports.date = azureCommon.date; | ||
// Other filters | ||
AzureStorage.LinearRetryPolicyFilter = azureCommon.LinearRetryPolicyFilter; | ||
AzureStorage.ExponentialRetryPolicyFilter = azureCommon.ExponentialRetryPolicyFilter; | ||
AzureStorage.RetryPolicyFilter = azureCommon.RetryPolicyFilter; | ||
window.AzureStorage = AzureStorage; | ||
module.exports.LinearRetryPolicyFilter = azureCommon.LinearRetryPolicyFilter; | ||
module.exports.ExponentialRetryPolicyFilter = azureCommon.ExponentialRetryPolicyFilter; | ||
module.exports.RetryPolicyFilter = azureCommon.RetryPolicyFilter; |
@@ -17,5 +17,3 @@ // | ||
var AzureStorage = window.AzureStorage || {}; | ||
AzureStorage.generateDevelopmentStorageCredentials = function (proxyUri) { | ||
module.exports.generateDevelopmentStorageCredentials = function (proxyUri) { | ||
var devStore = 'UseDevelopmentStorage=true;'; | ||
@@ -31,10 +29,10 @@ if(proxyUri){ | ||
AzureStorage.FileService = FileService; | ||
AzureStorage.FileUtilities = require('../lib/services/file/fileutilities'); | ||
module.exports.FileService = FileService; | ||
module.exports.FileUtilities = require('../lib/services/file/fileutilities'); | ||
AzureStorage.createFileService = function (storageAccountOrConnectionString, storageAccessKey, host) { | ||
module.exports.createFileService = function (storageAccountOrConnectionString, storageAccessKey, host) { | ||
return new FileService(storageAccountOrConnectionString, storageAccessKey, host); | ||
}; | ||
AzureStorage.createFileServiceWithSas = function (hostUri, sasToken) { | ||
module.exports.createFileServiceWithSas = function (hostUri, sasToken) { | ||
return new FileService(null, null, hostUri, sasToken); | ||
@@ -47,3 +45,3 @@ }; | ||
AzureStorage.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy) | ||
module.exports.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy) | ||
{ | ||
@@ -56,18 +54,16 @@ var storageSettings = StorageServiceClient.getStorageSettings(storageAccountOrConnectionString, storageAccessKey); | ||
AzureStorage.Constants = azureCommon.Constants; | ||
AzureStorage.StorageUtilities = azureCommon.StorageUtilities; | ||
AzureStorage.AccessCondition = azureCommon.AccessCondition; | ||
module.exports.Constants = azureCommon.Constants; | ||
module.exports.StorageUtilities = azureCommon.StorageUtilities; | ||
module.exports.AccessCondition = azureCommon.AccessCondition; | ||
AzureStorage.SR = azureCommon.SR; | ||
AzureStorage.StorageServiceClient = StorageServiceClient; | ||
AzureStorage.Logger = azureCommon.Logger; | ||
AzureStorage.WebResource = azureCommon.WebResource; | ||
AzureStorage.Validate = azureCommon.validate; | ||
AzureStorage.date = azureCommon.date; | ||
module.exports.SR = azureCommon.SR; | ||
module.exports.StorageServiceClient = StorageServiceClient; | ||
module.exports.Logger = azureCommon.Logger; | ||
module.exports.WebResource = azureCommon.WebResource; | ||
module.exports.Validate = azureCommon.validate; | ||
module.exports.date = azureCommon.date; | ||
// Other filters | ||
AzureStorage.LinearRetryPolicyFilter = azureCommon.LinearRetryPolicyFilter; | ||
AzureStorage.ExponentialRetryPolicyFilter = azureCommon.ExponentialRetryPolicyFilter; | ||
AzureStorage.RetryPolicyFilter = azureCommon.RetryPolicyFilter; | ||
window.AzureStorage = AzureStorage; | ||
module.exports.LinearRetryPolicyFilter = azureCommon.LinearRetryPolicyFilter; | ||
module.exports.ExponentialRetryPolicyFilter = azureCommon.ExponentialRetryPolicyFilter; | ||
module.exports.RetryPolicyFilter = azureCommon.RetryPolicyFilter; |
@@ -17,5 +17,3 @@ // | ||
var AzureStorage = window.AzureStorage || {}; | ||
AzureStorage.generateDevelopmentStorageCredentials = function (proxyUri) { | ||
module.exports.generateDevelopmentStorageCredentials = function (proxyUri) { | ||
var devStore = 'UseDevelopmentStorage=true;'; | ||
@@ -31,11 +29,11 @@ if(proxyUri){ | ||
AzureStorage.QueueService = QueueService; | ||
AzureStorage.QueueUtilities = require('../lib/services/queue/queueutilities'); | ||
AzureStorage.QueueMessageEncoder = require('../lib/services/queue/queuemessageencoder'); | ||
module.exports.QueueService = QueueService; | ||
module.exports.QueueUtilities = require('../lib/services/queue/queueutilities'); | ||
module.exports.QueueMessageEncoder = require('../lib/services/queue/queuemessageencoder'); | ||
AzureStorage.createQueueService = function (storageAccountOrConnectionString, storageAccessKey, host) { | ||
module.exports.createQueueService = function (storageAccountOrConnectionString, storageAccessKey, host) { | ||
return new QueueService(storageAccountOrConnectionString, storageAccessKey, host); | ||
}; | ||
AzureStorage.createQueueServiceWithSas = function(hostUri, sasToken) { | ||
module.exports.createQueueServiceWithSas = function(hostUri, sasToken) { | ||
return new QueueService(null, null, hostUri, sasToken); | ||
@@ -48,3 +46,3 @@ }; | ||
AzureStorage.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy) | ||
module.exports.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy) | ||
{ | ||
@@ -57,18 +55,16 @@ var storageSettings = StorageServiceClient.getStorageSettings(storageAccountOrConnectionString, storageAccessKey); | ||
AzureStorage.Constants = azureCommon.Constants; | ||
AzureStorage.StorageUtilities = azureCommon.StorageUtilities; | ||
AzureStorage.AccessCondition = azureCommon.AccessCondition; | ||
module.exports.Constants = azureCommon.Constants; | ||
module.exports.StorageUtilities = azureCommon.StorageUtilities; | ||
module.exports.AccessCondition = azureCommon.AccessCondition; | ||
AzureStorage.SR = azureCommon.SR; | ||
AzureStorage.StorageServiceClient = StorageServiceClient; | ||
AzureStorage.Logger = azureCommon.Logger; | ||
AzureStorage.WebResource = azureCommon.WebResource; | ||
AzureStorage.Validate = azureCommon.validate; | ||
AzureStorage.date = azureCommon.date; | ||
module.exports.SR = azureCommon.SR; | ||
module.exports.StorageServiceClient = StorageServiceClient; | ||
module.exports.Logger = azureCommon.Logger; | ||
module.exports.WebResource = azureCommon.WebResource; | ||
module.exports.Validate = azureCommon.validate; | ||
module.exports.date = azureCommon.date; | ||
// Other filters | ||
AzureStorage.LinearRetryPolicyFilter = azureCommon.LinearRetryPolicyFilter; | ||
AzureStorage.ExponentialRetryPolicyFilter = azureCommon.ExponentialRetryPolicyFilter; | ||
AzureStorage.RetryPolicyFilter = azureCommon.RetryPolicyFilter; | ||
window.AzureStorage = AzureStorage; | ||
module.exports.LinearRetryPolicyFilter = azureCommon.LinearRetryPolicyFilter; | ||
module.exports.ExponentialRetryPolicyFilter = azureCommon.ExponentialRetryPolicyFilter; | ||
module.exports.RetryPolicyFilter = azureCommon.RetryPolicyFilter; |
@@ -17,5 +17,3 @@ // | ||
var AzureStorage = window.AzureStorage || {}; | ||
AzureStorage.generateDevelopmentStorageCredentials = function (proxyUri) { | ||
module.exports.generateDevelopmentStorageCredentials = function (proxyUri) { | ||
var devStore = 'UseDevelopmentStorage=true;'; | ||
@@ -30,12 +28,12 @@ if(proxyUri){ | ||
var TableService = require('../lib/services/table/tableservice'); | ||
AzureStorage.TableService = TableService; | ||
AzureStorage.TableQuery = require('../lib/services/table/tablequery'); | ||
AzureStorage.TableBatch = require('../lib/services/table/tablebatch'); | ||
AzureStorage.TableUtilities = require('../lib/services/table/tableutilities'); | ||
module.exports.TableService = TableService; | ||
module.exports.TableQuery = require('../lib/services/table/tablequery'); | ||
module.exports.TableBatch = require('../lib/services/table/tablebatch'); | ||
module.exports.TableUtilities = require('../lib/services/table/tableutilities'); | ||
AzureStorage.createTableService = function (storageAccountOrConnectionString, storageAccessKey, host) { | ||
module.exports.createTableService = function (storageAccountOrConnectionString, storageAccessKey, host) { | ||
return new TableService(storageAccountOrConnectionString, storageAccessKey, host); | ||
}; | ||
AzureStorage.createTableServiceWithSas = function (hostUri, sasToken) { | ||
module.exports.createTableServiceWithSas = function (hostUri, sasToken) { | ||
return new TableService(null, null, hostUri, sasToken); | ||
@@ -48,3 +46,3 @@ }; | ||
AzureStorage.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy) | ||
module.exports.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy) | ||
{ | ||
@@ -57,18 +55,16 @@ var storageSettings = StorageServiceClient.getStorageSettings(storageAccountOrConnectionString, storageAccessKey); | ||
AzureStorage.Constants = azureCommon.Constants; | ||
AzureStorage.StorageUtilities = azureCommon.StorageUtilities; | ||
AzureStorage.AccessCondition = azureCommon.AccessCondition; | ||
module.exports.Constants = azureCommon.Constants; | ||
module.exports.StorageUtilities = azureCommon.StorageUtilities; | ||
module.exports.AccessCondition = azureCommon.AccessCondition; | ||
AzureStorage.SR = azureCommon.SR; | ||
AzureStorage.StorageServiceClient = StorageServiceClient; | ||
AzureStorage.Logger = azureCommon.Logger; | ||
AzureStorage.WebResource = azureCommon.WebResource; | ||
AzureStorage.Validate = azureCommon.validate; | ||
AzureStorage.date = azureCommon.date; | ||
module.exports.SR = azureCommon.SR; | ||
module.exports.StorageServiceClient = StorageServiceClient; | ||
module.exports.Logger = azureCommon.Logger; | ||
module.exports.WebResource = azureCommon.WebResource; | ||
module.exports.Validate = azureCommon.validate; | ||
module.exports.date = azureCommon.date; | ||
// Other filters | ||
AzureStorage.LinearRetryPolicyFilter = azureCommon.LinearRetryPolicyFilter; | ||
AzureStorage.ExponentialRetryPolicyFilter = azureCommon.ExponentialRetryPolicyFilter; | ||
AzureStorage.RetryPolicyFilter = azureCommon.RetryPolicyFilter; | ||
window.AzureStorage = AzureStorage; | ||
module.exports.LinearRetryPolicyFilter = azureCommon.LinearRetryPolicyFilter; | ||
module.exports.ExponentialRetryPolicyFilter = azureCommon.ExponentialRetryPolicyFilter; | ||
module.exports.RetryPolicyFilter = azureCommon.RetryPolicyFilter; |
@@ -18,11 +18,24 @@ // | ||
var browserify = require('browserify'); | ||
var factor = require('factor-bundle'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var UglifyJS = require('uglify-js'); | ||
var version = process.argv[2] || process.env.AZURE_STORAGE_JAVASCRIPT_VERSION || ''; | ||
var license = [ | ||
'// Azure Storage JavaScript Client Library ' + version, | ||
'// Copyright (c) Microsoft and contributors. All rights reserved.' | ||
].join('\n') + '\n'; | ||
var outputFolder = 'bundle'; | ||
var outputFolderPath = path.resolve(__dirname, outputFolder); | ||
console.log('Generating Azure Storage JavaScript Client Library to ' + outputFolderPath + ' ...\n'); | ||
console.log('Generating Azure Storage JavaScript Client Library to ' + outputFolderPath + ' ...'); | ||
if (version === '') { | ||
console.warn( | ||
'No version number provided.', | ||
'Please set up a version number by first parameter of bundle.js or environment value AZURE_STORAGE_JAVASCRIPT_VERSION' | ||
); | ||
} | ||
if (!fs.existsSync(outputFolderPath)) { | ||
@@ -32,20 +45,34 @@ fs.mkdirSync(outputFolderPath); | ||
var b = browserify([ | ||
path.resolve(__dirname, 'azure-storage.blob.export.js'), | ||
path.resolve(__dirname, 'azure-storage.file.export.js'), | ||
path.resolve(__dirname, 'azure-storage.queue.export.js'), | ||
path.resolve(__dirname, 'azure-storage.table.export.js') | ||
], {require: ['stream', 'util', 'buffer']}); | ||
function build(exportFilePath, outputFilePath, moduleName, isMinify) { | ||
browserify(exportFilePath, {standalone: moduleName}).bundle(function (err, src) { | ||
if (err) { | ||
console.error('Failed when parsing', exportFilePath, err); | ||
return; | ||
} | ||
b.plugin(factor, { | ||
outputs: [ | ||
path.resolve(outputFolderPath, 'azure-storage.blob.js'), | ||
path.resolve(outputFolderPath, 'azure-storage.file.js'), | ||
path.resolve(outputFolderPath, 'azure-storage.queue.js'), | ||
path.resolve(outputFolderPath, 'azure-storage.table.js') | ||
] | ||
}); | ||
var code = (src || '').toString(); | ||
if (isMinify) { | ||
result = UglifyJS.minify(code.trim()); | ||
if (result.error) { | ||
console.error('Minify failed when parsing', exportFilePath, err); | ||
return; | ||
} | ||
b.bundle().pipe( | ||
fs.createWriteStream(path.resolve(outputFolderPath, 'azure-storage.common.js')) | ||
); | ||
code = result.code; | ||
} | ||
var ws = fs.createWriteStream(outputFilePath); | ||
ws.write(license); | ||
ws.write(code); | ||
ws.end(); | ||
}); | ||
} | ||
build(path.resolve(__dirname, 'azure-storage.blob.export.js'), path.resolve(outputFolderPath, 'azure-storage.blob.js'), 'AzureStorage.Blob'); | ||
build(path.resolve(__dirname, 'azure-storage.table.export.js'), path.resolve(outputFolderPath, 'azure-storage.table.js'), 'AzureStorage.Table'); | ||
build(path.resolve(__dirname, 'azure-storage.queue.export.js'), path.resolve(outputFolderPath, 'azure-storage.queue.js'), 'AzureStorage.Queue'); | ||
build(path.resolve(__dirname, 'azure-storage.file.export.js'), path.resolve(outputFolderPath, 'azure-storage.file.js'), 'AzureStorage.File'); | ||
build(path.resolve(__dirname, 'azure-storage.blob.export.js'), path.resolve(outputFolderPath, 'azure-storage.blob.min.js'), 'AzureStorage.Blob', true); | ||
build(path.resolve(__dirname, 'azure-storage.table.export.js'), path.resolve(outputFolderPath, 'azure-storage.table.min.js'), 'AzureStorage.Table', true); | ||
build(path.resolve(__dirname, 'azure-storage.queue.export.js'), path.resolve(outputFolderPath, 'azure-storage.queue.min.js'), 'AzureStorage.Queue', true); | ||
build(path.resolve(__dirname, 'azure-storage.file.export.js'), path.resolve(outputFolderPath, 'azure-storage.file.min.js'), 'AzureStorage.File', true); |
Note: This is the change log file for Azure Storage JavaScript Client Library. | ||
2018.03 Version 0.2.8-preview.15 | ||
* Supported UMD module standard. | ||
* Dropped `azure-storage.common.js`. | ||
* Generated browser compatible JavaScript files based on Microsoft Azure Storage SDK for Node.js 2.8.1. | ||
2018.02 Version 0.2.8-preview.14 | ||
@@ -4,0 +10,0 @@ |
@@ -5,12 +5,11 @@ # Azure Storage JavaScript Client Library for Browsers | ||
There are 5 generated JavaScript files for Azure Storage JavaScript Client Library: | ||
- `azure-storage.common.js` contains the common part for other 4 JavaScript files. | ||
- `azure-storage.table.js` contains the Azure Storage table service operation logic, which depends on azure-storage.common.js | ||
- `azure-storage.blob.js` contains the Azure Storage blob service operation logic, which depends on azure-storage.common.js | ||
- `azure-storage.queue.js` contains the Azure Storage queue service operation logic, which depends on azure-storage.common.js | ||
- `azure-storage.file.js` contains the Azure Storage file service operation logic, which depends on azure-storage.common.js | ||
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](https://aka.ms/downloadazurestoragejs) or [azure-storage-node/browser/samples](samples), 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-blob.html` demonstrates how to operate with Azure Storage blob service in the browser | ||
- `sample-queue.html` demonstrates how to operate with Azure Storage queue service in the browser | ||
@@ -23,9 +22,13 @@ - `sample-file.html` demonstrates how to operate with Azure Storage file service in the browser | ||
## Limitations | ||
## Module Support | ||
The Azure Storage JavaScript Client Library is currently in preview stage, there are some known issues or limitations as follows. | ||
Above JavaScript files are all [UMD compatible](https://github.com/umdjs/umd). 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 | ||
Compatibility with mobile browsers have not been fully validated, please open issues when you get errors. Current validated browsers are as below: | ||
Compatibility with mobile browsers have not been fully validated, please open issues when you get errors. Latest validated browser versions are as below: | ||
@@ -40,10 +43,13 @@ | Chrome | Firefox | Internet Explorer | Microsoft Edge | | ||
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 and a common shared file. | ||
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 5 separated JavaScript files: | ||
- `azure-storage.common.js` | ||
The generated JavaScript Client Library includes 8 separated JavaScript files: | ||
- `azure-storage.blob.js` | ||
- `azure-storage.table.js` | ||
- `azure-storage.blob.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` | ||
@@ -79,3 +85,3 @@ Let's get started to generate the Azure Storage JavaScript Client Library! | ||
```Batchfile | ||
npm run genjs | ||
npm run genjs [VERSION_NUMBER] | ||
``` | ||
@@ -85,27 +91,10 @@ | ||
If everything goes well, the generated JavaScript files should be saved to `azure-storage-node/browser/bundle`. There will be 5 generated JavaScript files totally: | ||
- `azure-storage.common.js` | ||
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.blob.js` | ||
- `azure-storage.queue.js` | ||
- `azure-storage.file.js` | ||
### Step 5: JavaScript Files Minify | ||
You are able to minify the generated JavaScript files with your favorite minify tools. Here we show the minify process with Node.js minify tool [uglifyJS](https://github.com/mishoo/UglifyJS2). | ||
Install uglifyJS: | ||
```Batchfile | ||
npm install -g uglify-js | ||
``` | ||
Minify the JavaScript files: | ||
```Batchfile | ||
uglifyjs --compress --mangle -- azure-storage.common.js > azure-storage.common.min.js | ||
uglifyjs --compress --mangle -- azure-storage.table.js > azure-storage.table.min.js | ||
uglifyjs --compress --mangle -- azure-storage.blob.js > azure-storage.blob.min.js | ||
uglifyjs --compress --mangle -- azure-storage.queue.js > azure-storage.queue.min.js | ||
uglifyjs --compress --mangle -- azure-storage.file.js > azure-storage.file.min.js | ||
``` | ||
- `azure-storage.blob.min.js` | ||
- `azure-storage.table.min.js` | ||
- `azure-storage.queue.min.js` | ||
- `azure-storage.file.min.js` |
Note: This is an Azure Storage only package. The all up Azure node sdk still has the old storage bits in there. In a future release, those storage bits will be removed and an npm dependency to this storage node sdk will | ||
be taken. This is a GA release and the changes described below indicate the changes from the Azure node SDK 0.9.8 available here - https://github.com/Azure/azure-sdk-for-node. | ||
2018.03 Version 2.8.1 | ||
ALL | ||
* Updated request and validator package dependencies to reduce vulnerability. | ||
* Fix a type assignment bug in tests for env variables. | ||
* Improved documents. | ||
2018.02 Version 2.8.0 | ||
@@ -5,0 +12,0 @@ |
@@ -247,3 +247,3 @@ // | ||
// when the stream is closed immediately after creating it | ||
if (!validator.isInt(this._fd)) { | ||
if (!validator.isInt('' + this._fd)) { | ||
this.once('open', close); | ||
@@ -250,0 +250,0 @@ return; |
@@ -40,3 +40,3 @@ // | ||
*/ | ||
USER_AGENT_PRODUCT_VERSION: '2.8.0', | ||
USER_AGENT_PRODUCT_VERSION: '2.8.1', | ||
@@ -43,0 +43,0 @@ /** |
{ | ||
"name": "azure-storage", | ||
"author": "Microsoft Corporation", | ||
"version": "2.8.0", | ||
"version": "2.8.1", | ||
"description": "Microsoft Azure Storage Client Library for Node.js", | ||
@@ -28,6 +28,6 @@ "typings": "typings/azure-storage/azure-storage.d.ts", | ||
"readable-stream": "~2.0.0", | ||
"request": "~2.81.0", | ||
"request": "~2.83.0", | ||
"underscore": "~1.8.3", | ||
"uuid": "^3.0.0", | ||
"validator": "~3.35.0", | ||
"validator": "~9.4.1", | ||
"xml2js": "0.2.8", | ||
@@ -37,3 +37,3 @@ "xmlbuilder": "0.4.3" | ||
"devDependencies": { | ||
"browserify": "^13.3.0", | ||
"browserify": "~15.2.0", | ||
"batchflow": "0.4.0", | ||
@@ -56,3 +56,4 @@ "coveralls": "^2.11.4", | ||
"nsp": "^2.2.0", | ||
"should": "1.2.x" | ||
"should": "1.2.x", | ||
"uglify-js": "~3.3.9" | ||
}, | ||
@@ -59,0 +60,0 @@ "homepage": "http://github.com/Azure/azure-storage-node", |
166
README.md
@@ -1,2 +0,2 @@ | ||
# Microsoft Azure Storage SDK for Node.js | ||
# Microsoft Azure Storage SDK for Node.js and JavaScript for Browsers | ||
@@ -8,3 +8,3 @@ [![NPM version](https://badge.fury.io/js/azure-storage.svg)](http://badge.fury.io/js/azure-storage) [![Slack](https://azurestorageslack.azurewebsites.net/badge.svg)]( https://azurestorageslack.azurewebsites.net) | ||
This project provides a Node.js package and a browser compatible [JavaScript Client Library](#azure-storage-javascript-client-library-for-browsers) that makes it easy to consume and manage Microsoft Azure Storage Services. | ||
This project provides a Node.js package and a browser compatible [JavaScript Client Library](https://github.com/Azure/azure-storage-node#azure-storage-javascript-client-library-for-browsers) that makes it easy to consume and manage Microsoft Azure Storage Services. | ||
@@ -15,8 +15,8 @@ > If you are looking for the Node.js SDK for other Azure services, visit [https://github.com/Azure/azure-sdk-for-node](https://github.com/Azure/azure-sdk-for-node). | ||
- Blobs | ||
- Create/Delete Containers | ||
- Create/Read/Update/Delete Blobs | ||
- Tables | ||
- Create/Delete Tables | ||
- Query/Create/Read/Update/Delete Entities | ||
- Blobs | ||
- Create/Delete Containers | ||
- Create/Read/Update/Delete Blobs | ||
- Files | ||
@@ -56,2 +56,71 @@ - Create/Delete Shares | ||
### Blob Storage | ||
The **createContainerIfNotExists** method can be used to create a | ||
container in which to store a blob: | ||
```Javascript | ||
var azure = require('azure-storage'); | ||
var blobService = azure.createBlobService(); | ||
blobService.createContainerIfNotExists('taskcontainer', { | ||
publicAccessLevel: 'blob' | ||
}, function(error, result, response) { | ||
if (!error) { | ||
// if result = true, container was created. | ||
// if result = false, container already existed. | ||
} | ||
}); | ||
``` | ||
To upload a file (assuming it is called task1-upload.txt and it is placed in the same folder as the script below), the method **createBlockBlobFromLocalFile** can be used. | ||
```Javascript | ||
var azure = require('azure-storage'); | ||
var blobService = azure.createBlobService(); | ||
blobService.createBlockBlobFromLocalFile('mycontainer', 'taskblob', 'task1-upload.txt', function(error, result, response) { | ||
if (!error) { | ||
// file uploaded | ||
} | ||
}); | ||
``` | ||
For page blobs, use **createPageBlobFromLocalFile**. There are other methods for uploading blobs also, such as **createBlockBlobFromText** or **createPageBlobFromStream**. | ||
There are also several ways to download block and page blobs. For example, **getBlobToStream** downloads the blob to a stream: | ||
```Javascript | ||
var blobService = azure.createBlobService(); | ||
var fs = require('fs'); | ||
blobService.getBlobToStream('mycontainer', 'taskblob', fs.createWriteStream('output.txt'), function(error, result, response) { | ||
if (!error) { | ||
// blob retrieved | ||
} | ||
}); | ||
``` | ||
To create a Shared Access Signature (SAS), use the **generateSharedAccessSignature** method. Additionally you can use the **date** helper functions to easily create a SAS that expires at some point relative to the current time. | ||
```Javascript | ||
var azure = require('azure-storage'); | ||
var blobService = azure.createBlobService(); | ||
var startDate = new Date(); | ||
var expiryDate = new Date(startDate); | ||
expiryDate.setMinutes(startDate.getMinutes() + 100); | ||
startDate.setMinutes(startDate.getMinutes() - 100); | ||
var sharedAccessPolicy = { | ||
AccessPolicy: { | ||
Permissions: azure.BlobUtilities.SharedAccessPermissions.READ, | ||
Start: startDate, | ||
Expiry: expiryDate | ||
} | ||
}; | ||
var token = blobService.generateSharedAccessSignature(containerName, blobName, sharedAccessPolicy); | ||
var sasUrl = blobService.getUrl(containerName, blobName, token); | ||
``` | ||
### Table Storage | ||
@@ -70,3 +139,3 @@ | ||
``` | ||
A new entity can be added by calling **insertEntity**: | ||
A new entity can be added by calling **insertEntity** or **insertOrReplaceEntity**: | ||
@@ -119,3 +188,3 @@ ```Javascript | ||
Use **TableQuery** to build complex queries: | ||
The method **replaceEntity** or **insertOrReplaceEntity** can be called to update/edit an existing entry. In the following example we asssume that an entity `'part2', 'row1'` with a field `'taskDone'` set to `false` already exists. | ||
@@ -125,9 +194,11 @@ ```Javascript | ||
var tableService = azure.createTableService(); | ||
var query = new azure.TableQuery() | ||
.top(5) | ||
.where('PartitionKey eq ?', 'part2'); | ||
var entity = { | ||
PartitionKey: entGen.String('part2'), | ||
RowKey: entGen.String('row1'), | ||
taskDone: entGen.Boolean(true), | ||
}; | ||
tableService.queryEntities('mytable', query, null, function(error, result, response) { | ||
tableService.insertOrReplaceEntity('mytable', entity, function(error, result, response) { | ||
if (!error) { | ||
// result.entries contains entities matching the query | ||
// result contains the entity with field 'taskDone' set to `true` | ||
} | ||
@@ -137,29 +208,14 @@ }); | ||
### Blob Storage | ||
Use **TableQuery** to build complex queries: | ||
The **createContainerIfNotExists** method can be used to create a | ||
container in which to store a blob: | ||
```Javascript | ||
var azure = require('azure-storage'); | ||
var blobService = azure.createBlobService(); | ||
blobService.createContainerIfNotExists('taskcontainer', { | ||
publicAccessLevel: 'blob' | ||
}, function(error, result, response) { | ||
if (!error) { | ||
// if result = true, container was created. | ||
// if result = false, container already existed. | ||
} | ||
}); | ||
``` | ||
var tableService = azure.createTableService(); | ||
var query = new azure.TableQuery() | ||
.top(5) | ||
.where('PartitionKey eq ?', 'part2'); | ||
To upload a file (assuming it is called task1-upload.txt and it is placed in the same folder as the script below), the method **createBlockBlobFromLocalFile** can be used. | ||
```Javascript | ||
var azure = require('azure-storage'); | ||
var blobService = azure.createBlobService(); | ||
blobService.createBlockBlobFromLocalFile('mycontainer', 'taskblob', 'task1-upload.txt', function(error, result, response) { | ||
tableService.queryEntities('mytable', query, null, function(error, result, response) { | ||
if (!error) { | ||
// file uploaded | ||
// result.entries contains entities matching the query | ||
} | ||
@@ -169,40 +225,2 @@ }); | ||
For page blobs, use **createPageBlobFromLocalFile**. There are other methods for uploading blobs also, such as **createBlockBlobFromText** or **createPageBlobFromStream**. | ||
There are also several ways to download block and page blobs. For example, **getBlobToStream** downloads the blob to a stream: | ||
```Javascript | ||
var blobService = azure.createBlobService(); | ||
var fs = require('fs'); | ||
blobService.getBlobToStream('mycontainer', 'taskblob', fs.createWriteStream('output.txt'), function(error, result, response) { | ||
if (!error) { | ||
// blob retrieved | ||
} | ||
}); | ||
``` | ||
To create a Shared Access Signature (SAS), use the **generateSharedAccessSignature** method. Additionally you can use the **date** helper functions to easily create a SAS that expires at some point relative to the current time. | ||
```Javascript | ||
var azure = require('azure-storage'); | ||
var blobService = azure.createBlobService(); | ||
var startDate = new Date(); | ||
var expiryDate = new Date(startDate); | ||
expiryDate.setMinutes(startDate.getMinutes() + 100); | ||
startDate.setMinutes(startDate.getMinutes() - 100); | ||
var sharedAccessPolicy = { | ||
AccessPolicy: { | ||
Permissions: azure.BlobUtilities.SharedAccessPermissions.READ, | ||
Start: startDate, | ||
Expiry: expiryDate | ||
} | ||
}; | ||
var token = blobService.generateSharedAccessSignature(containerName, blobName, sharedAccessPolicy); | ||
var sasUrl = blobService.getUrl(containerName, blobName, token); | ||
``` | ||
### Queue Storage | ||
@@ -508,3 +526,3 @@ | ||
You can also choose to download the JavaScript Client Library provided by us, or generate the library by yourself. Please refer to the [README.md](browser/README.md) under `browser` folder for detailed usage guidelines. | ||
You can also choose to download the JavaScript Client Library provided by us, or generate the library by yourself. Please refer to the [README.md](https://github.com/Azure/azure-storage-node/blob/master/browser/README.md) under `browser` folder for detailed usage guidelines. | ||
@@ -517,3 +535,3 @@ ## Downloading Azure Storage JavaScript Client Library | ||
We also 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 and a common shared file. For more detailed information, refer to [README.md](browser/README.md) under `browser` folder. | ||
We also 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. For more detailed information, refer to [README.md](https://github.com/Azure/azure-storage-node/blob/master/browser/README.md) under `browser` folder. | ||
@@ -520,0 +538,0 @@ # JsDoc |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2597866
36806
554
20
25
+ Addedajv@5.5.2(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedboom@4.3.15.3.3(transitive)
+ Addedcryptiles@3.2.1(transitive)
+ Addedfast-deep-equal@1.1.0(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.0.3(transitive)
+ Addedhawk@6.0.2(transitive)
+ Addedhoek@4.3.1(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedjson-schema-traverse@0.3.1(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedrequest@2.83.0(transitive)
+ Addedsntp@2.1.0(transitive)
+ Addedvalidator@9.4.1(transitive)
- Removedajv@4.11.8(transitive)
- Removedassert-plus@0.2.0(transitive)
- Removedaws-sign2@0.6.0(transitive)
- Removedboom@2.10.1(transitive)
- Removedcall-bind@1.0.8(transitive)
- Removedcall-bind-apply-helpers@1.0.1(transitive)
- Removedcall-bound@1.0.3(transitive)
- Removedcryptiles@2.0.5(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddunder-proto@1.0.1(transitive)
- Removedes-define-property@1.0.1(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-object-atoms@1.0.0(transitive)
- Removedform-data@2.1.4(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.7(transitive)
- Removedget-proto@1.0.1(transitive)
- Removedgopd@1.2.0(transitive)
- Removedhar-schema@1.0.5(transitive)
- Removedhar-validator@4.2.1(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhawk@3.1.3(transitive)
- Removedhoek@2.16.3(transitive)
- Removedhttp-signature@1.1.1(transitive)
- Removedisarray@2.0.5(transitive)
- Removedjson-stable-stringify@1.2.1(transitive)
- Removedjsonify@0.0.1(transitive)
- Removedmath-intrinsics@1.1.0(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedperformance-now@0.2.0(transitive)
- Removedqs@6.4.1(transitive)
- Removedrequest@2.81.0(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedsntp@1.0.9(transitive)
- Removedvalidator@3.35.0(transitive)
Updatedrequest@~2.83.0
Updatedvalidator@~9.4.1