NPM Dependencies UPDATE

This commit is contained in:
Luis Fernando Molina committed 2018-05-02 10:22:14 +02:00
1 parent d3bc5e34f6
commit 5bfb4ff32a
732 files changed
+13367 -62155

No files matched your search

+15
View File
@@ -1,5 +1,20 @@
Note: This is the change log file for Azure Storage JavaScript Client Library.
2018.04 Version 2.8.100+2.8.2
* Fixed a bug that retry policy will not retry for XHR error in browsers.
* Updated README.md under browser folder to make it more clear about the zip file downloading link.
* Updated github.io API reference title to include JavaScript.
* Updated local HTTP server requirements for IE11 and Chrome 56 in samples and documents.
* Added support for running UT/FT in browsers like Chrome based on Karma, with command `npm run jstest`.
* Generated browser compatible JavaScript files based on Microsoft Azure Storage SDK for Node.js 2.8.2.
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
* Generated browser compatible JavaScript files based on Microsoft Azure Storage SDK for Node.js 2.8.0.
+52 -47
View File
@@ -2,47 +2,69 @@
* Join the community discussion on Slack! [![Slack](https://azurestorageslack.azurewebsites.net/badge.svg)]( https://azurestorageslack.azurewebsites.net)
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
## Downloading
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-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
- `sample-file.html` demonstrates how to operate with Azure Storage file service in the browser
It's recommended to use the Azure Storage JavaScript Client Library provided by us. Please [download the latest library](https://aka.ms/downloadazurestoragejs).
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 following online links, you will find 4 HTML samples:
- [sample-blob.html](https://dmrelease.blob.core.windows.net/azurestoragejssample/samples/sample-blob.html) demonstrates how to operate with Azure Storage blob service in the browser
- [sample-table.html](https://dmrelease.blob.core.windows.net/azurestoragejssample/samples/sample-table.html) demonstrates how to operate with Azure Storage table service in the browser
- [sample-queue.html](https://dmrelease.blob.core.windows.net/azurestoragejssample/samples/sample-queue.html) demonstrates how to operate with Azure Storage queue service in the browser
- [sample-file.html](https://dmrelease.blob.core.windows.net/azurestoragejssample/samples/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 IE browser.
**Note**: An HTTP server should be set to host the samples for IE11 and Chrome (56 or newer versions).
## Limitations
Or you can directly try with following online samples:
- [sample-blob](https://dmrelease.blob.core.windows.net/azurestoragejssample/samples/sample-blob.html)
- [sample-table](https://dmrelease.blob.core.windows.net/azurestoragejssample/samples/sample-table.html)
- [sample-queue](https://dmrelease.blob.core.windows.net/azurestoragejssample/samples/sample-queue.html)
- [sample-file](https://dmrelease.blob.core.windows.net/azurestoragejssample/samples/sample-file.html)
The Azure Storage JavaScript Client Library is currently in preview stage, there are some known issues or limitations as follows.
## Module Support
### Compatibility
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 with mobile browsers have not been fully validated, please open issues when you get errors. Current validated browsers are as below:
## Compatibility
| Chrome | Firefox | Internet Explorer | Microsoft Edge |
|------------|----------|--------------------|-----------------|
| v64 | v58 | v11 | v41 |
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 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`
- `azure-storage.table.js`
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!
@@ -73,34 +95,17 @@ npm install
We provide bundle scripts to help quickly generate the JavaScript Client Library. At the root directory of the cloned repo:
```Batchfile
npm run genjs
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 5 generated JavaScript files totally:
- `azure-storage.common.js`
- `azure-storage.table.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.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`
+19 -23
View File
@@ -14,9 +14,7 @@
// limitations under the License.
//
var AzureStorage = window.AzureStorage || {};
AzureStorage.generateDevelopmentStorageCredentials = function (proxyUri) {
module.exports.generateDevelopmentStorageCredentials = function (proxyUri) {
var devStore = 'UseDevelopmentStorage=true;';
if(proxyUri){
devStore += 'DevelopmentStorageProxyUri=' + proxyUri;
@@ -27,18 +25,18 @@ AzureStorage.generateDevelopmentStorageCredentials = function (proxyUri) {
var BlobService = require('../lib/services/blob/blobservice.browser');
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);
};
@@ -46,7 +44,7 @@ var azureCommon = require('../lib/common/common.browser');
var StorageServiceClient = azureCommon.StorageServiceClient;
var SharedKey = azureCommon.SharedKey;
AzureStorage.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy)
module.exports.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy)
{
var storageSettings = StorageServiceClient.getStorageSettings(storageAccountOrConnectionString, storageAccessKey);
var sharedKey = new SharedKey(storageSettings._name, storageSettings._key);
@@ -54,20 +52,18 @@ AzureStorage.generateAccountSharedAccessSignature = function(storageAccountOrCon
return sharedKey.generateAccountSignedQueryString(sharedAccessAccountPolicy);
};
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 -22
View File
@@ -14,9 +14,7 @@
// limitations under the License.
//
var AzureStorage = window.AzureStorage || {};
AzureStorage.generateDevelopmentStorageCredentials = function (proxyUri) {
module.exports.generateDevelopmentStorageCredentials = function (proxyUri) {
var devStore = 'UseDevelopmentStorage=true;';
if(proxyUri){
devStore += 'DevelopmentStorageProxyUri=' + proxyUri;
@@ -27,14 +25,14 @@ AzureStorage.generateDevelopmentStorageCredentials = function (proxyUri) {
var FileService = require('../lib/services/file/fileservice.browser');
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);
};
@@ -42,7 +40,7 @@ var azureCommon = require('../lib/common/common.browser');
var StorageServiceClient = azureCommon.StorageServiceClient;
var SharedKey = azureCommon.SharedKey;
AzureStorage.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy)
module.exports.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy)
{
var storageSettings = StorageServiceClient.getStorageSettings(storageAccountOrConnectionString, storageAccessKey);
var sharedKey = new SharedKey(storageSettings._name, storageSettings._key);
@@ -50,20 +48,18 @@ AzureStorage.generateAccountSharedAccessSignature = function(storageAccountOrCon
return sharedKey.generateAccountSignedQueryString(sharedAccessAccountPolicy);
};
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;
+19 -23
View File
@@ -14,9 +14,7 @@
// limitations under the License.
//
var AzureStorage = window.AzureStorage || {};
AzureStorage.generateDevelopmentStorageCredentials = function (proxyUri) {
module.exports.generateDevelopmentStorageCredentials = function (proxyUri) {
var devStore = 'UseDevelopmentStorage=true;';
if(proxyUri){
devStore += 'DevelopmentStorageProxyUri=' + proxyUri;
@@ -27,15 +25,15 @@ AzureStorage.generateDevelopmentStorageCredentials = function (proxyUri) {
var QueueService = require('../lib/services/queue/queueservice');
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);
};
@@ -43,7 +41,7 @@ var azureCommon = require('../lib/common/common.browser');
var StorageServiceClient = azureCommon.StorageServiceClient;
var SharedKey = azureCommon.SharedKey;
AzureStorage.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy)
module.exports.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy)
{
var storageSettings = StorageServiceClient.getStorageSettings(storageAccountOrConnectionString, storageAccessKey);
var sharedKey = new SharedKey(storageSettings._name, storageSettings._key);
@@ -51,20 +49,18 @@ AzureStorage.generateAccountSharedAccessSignature = function(storageAccountOrCon
return sharedKey.generateAccountSignedQueryString(sharedAccessAccountPolicy);
};
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;
+20 -24
View File
@@ -14,9 +14,7 @@
// limitations under the License.
//
var AzureStorage = window.AzureStorage || {};
AzureStorage.generateDevelopmentStorageCredentials = function (proxyUri) {
module.exports.generateDevelopmentStorageCredentials = function (proxyUri) {
var devStore = 'UseDevelopmentStorage=true;';
if(proxyUri){
devStore += 'DevelopmentStorageProxyUri=' + proxyUri;
@@ -26,16 +24,16 @@ AzureStorage.generateDevelopmentStorageCredentials = function (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);
};
@@ -43,7 +41,7 @@ var azureCommon = require('../lib/common/common.browser');
var StorageServiceClient = azureCommon.StorageServiceClient;
var SharedKey = azureCommon.SharedKey;
AzureStorage.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy)
module.exports.generateAccountSharedAccessSignature = function(storageAccountOrConnectionString, storageAccessKey, sharedAccessAccountPolicy)
{
var storageSettings = StorageServiceClient.getStorageSettings(storageAccountOrConnectionString, storageAccessKey);
var sharedKey = new SharedKey(storageSettings._name, storageSettings._key);
@@ -51,20 +49,18 @@ AzureStorage.generateAccountSharedAccessSignature = function(storageAccountOrCon
return sharedKey.generateAccountSignedQueryString(sharedAccessAccountPolicy);
};
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;
+46 -19
View File
@@ -15,35 +15,62 @@
//
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.',
'You can set up a version number by first parameter of bundle.js or environment value AZURE_STORAGE_JAVASCRIPT_VERSION'
);
}
if (!fs.existsSync(outputFolderPath)) {
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);
+12 -15
View File
@@ -17,7 +17,7 @@
<div class="panel panel-danger">
<div class="panel-body">
<b>Note</b>: You may need set up a HTTP server to host this sample for IE browser, because IndexedDB is only available on websites with http or https URL schemes in IE. Azure Storage JavaScript Client Library currently depends on IndexedDB.
<b>Note</b>: You may need set up a HTTP server to host this sample for IE11 and latest Chrome.
</div>
</div>
@@ -40,10 +40,9 @@
<h2 id="step2">Step 2: Importing Azure Storage JavaScript Client Library</h2>
<p>
Importing <code>azure-storage.common.js</code> and <code>azure-storage.blob.js</code> in your HTML file for blob operations, and make sure <code>azure-storage.common.js</code> is in front of <code>azure-storage.blob.js</code>.
Importing <code>azure-storage.blob.js</code> in your HTML file for blob operations.
<p>
<pre>
&lt;script src="azure-storage.common.js"&gt;&lt;/script&gt;
&lt;script src="azure-storage.blob.js"&gt;&lt;/script&gt;
</pre>
@@ -54,15 +53,16 @@
</p>
<pre>
var blobUri = 'https://' + 'STORAGE_ACCOUNT' + '.blob.core.windows.net';
var blobService = AzureStorage.createBlobServiceWithSas(blobUri, 'SAS_TOKEN');
var blobService = AzureStorage.Blob.createBlobServiceWithSas(blobUri, 'SAS_TOKEN');
</pre>
<p>
In Azure Storage JavaScript Client Library, a global variable <code>AzureStorage</code> is the start point where we can create service objects for blob/table/queue/file and access to the storage utilities.
You can load Azure Storage JavaScript Client Library in a CommonJS or AMD environment by JavaScript module loaders. If no module system is found, global variable <code>AzureStorage.Blob</code> will be set, which is the start point where we can create service objects for blob and access to the storage utilities.
</p>
<div class="panel panel-primary">
<div class="panel-body">
<b>How to get full detailed API definitions? </b> Currently, the JavaScript Client Library shares the same API definitions with Node.js SDK.
Please check API details on <a href="http://azure.github.io/azure-storage-node/">Azure Storage Node.js API reference documents</a>. The JavaScript global variable <code>AzureStorage</code> is just like the object <code>require('azure-storage')</code> returns in Node.js.
<b>How to get full detailed API definitions? </b> Currently, the JavaScript Client Library shares almost the same API definitions with Node.js SDK, besides Node.js runtime specific APIs.
Please check API details on <a href="http://azure.github.io/azure-storage-node/">Azure Storage API reference documents</a>. The JavaScript global variable <code>AzureStorage.Blob</code> is just like the object <code>require('azure-storage')</code> returns in Node.js, but limits to Blob related interfaces.
Go to <a href="https://azure.github.io/azure-storage-node/BlobService.html">BlobService</a> to view possible methods provided by <code>BlobService</code> class.
</div>
</div>
<div class="panel panel-danger">
@@ -264,16 +264,13 @@ blobService.deleteBlobIfExists(container, blob, function(error, result) {
<h3 id="step6">Step 6: Creating your JavaScript Application based on Azure Storage JavaScript Client Library</h3>
<ul>
<li>1. Setting CORS rules for your selected Azure-Storage account blob service.</li>
<li>2. Including "azure-storage.common.js" in the html file.</li>
<li>3. Including functional file(s) needed, such as "azure-storage.blob.js" for blob operation.</li>
<li>4. Using keyword "AzureStorage" to access to Azure storage JavaScript APIs.</li>
<li>5. Referring to <a href="http://azure.github.io/azure-storage-node/">Azure Storage Node.js SDK documents</a> for detailed API definitions which keep same with JavaScript APIs.</li>
<li>2. Including functional file(s) needed, such as "azure-storage.blob.js" for blob operation.</li>
<li>3. Using keyword "AzureStorage.Blob" to access to Azure storage JavaScript APIs for blobs.</li>
<li>4. Referring to <a href="http://azure.github.io/azure-storage-node/">API documents</a> for detailed API definitions.</li>
</ul>
<p> You can view the source code of this sample for detailed reference. </p>
</div>
<!-- azure-storage.common.js also exports Node.js module stream, util and buffer -->
<script src="../bundle/azure-storage.common.js"></script>
<script src="../bundle/azure-storage.blob.js"></script>
<script>
@@ -305,7 +302,7 @@ blobService.deleteBlobIfExists(container, blob, function(error, result) {
return null;
blobUri = 'https://' + account + '.blob.core.windows.net';
var blobService = AzureStorage.createBlobServiceWithSas(blobUri, sas).withFilter(new AzureStorage.ExponentialRetryPolicyFilter());
var blobService = AzureStorage.Blob.createBlobServiceWithSas(blobUri, sas).withFilter(new AzureStorage.Blob.ExponentialRetryPolicyFilter());
return blobService;
}
@@ -366,7 +363,7 @@ blobService.deleteBlobIfExists(container, blob, function(error, result) {
return;
var container = document.getElementById('newcontainer').value;
if (!AzureStorage.Validate.containerNameIsValid(container, function(err, res){})) {
if (!AzureStorage.Blob.Validate.containerNameIsValid(container, function(err, res){})) {
alert('Invalid container name!');
return;
}
+12 -14
View File
@@ -18,7 +18,7 @@
<div class="panel panel-danger">
<div class="panel-body">
<b>Note</b>: You may need set up a HTTP server to host this sample for IE browser, because IndexedDB is only available on websites with http or https URL schemes in IE. Azure Storage JavaScript Client Library currently depends on IndexedDB.
<b>Note</b>: You may need set up a HTTP server to host this sample for IE11 and latest Chrome.
</div>
</div>
@@ -41,10 +41,9 @@
<h2 id="step2">Step 2: Importing Azure Storage JavaScript Files</h2>
<p>
Importing <code>azure-storage.common.js</code> and <code>azure-storage.file.js</code> in your HTML file for file operations, and make sure <code>azure-storage.common.js</code> is in front of <code>azure-storage.file.js</code>.
Importing <code>azure-storage.file.js</code> in your HTML file for file operations.
<p>
<pre>
&lt;script src="azure-storage.common.js"&gt;&lt;/script&gt;
&lt;script src="azure-storage.file.js"&gt;&lt;/script&gt;
</pre>
@@ -55,15 +54,16 @@
</p>
<pre>
var fileUri = 'https://' + 'STORAGE_ACCOUNT' + '.file.core.windows.net';
var fileService = AzureStorage.createFileServiceWithSas(fileUri, 'SAS_TOKEN');
var fileService = AzureStorage.File.createFileServiceWithSas(fileUri, 'SAS_TOKEN');
</pre>
<p>
In Azure Storage JavaScript Client Library, a global variable <code>AzureStorage</code> is the start point where we can create service objects for blob/table/queue/file and access to the storage utilities.
You can load Azure Storage JavaScript Client Library in a CommonJS or AMD environment by JavaScript module loaders. If no module system is found, global variable <code>AzureStorage.File</code> will be set, which is the start point where we can create service objects for file and access to the storage utilities.
</p>
<div class="panel panel-primary">
<div class="panel-body">
<b>How to get full detailed API definitions? </b> Currently, the JavaScript Client Library shares the same API definitions with Node.js SDK.
Please check API details on <a href="http://azure.github.io/azure-storage-node/">Azure Storage Node.js API reference documents</a>. The JavaScript global variable <code>AzureStorage</code> is just like the object <code>require('azure-storage')</code> returns in Node.js.
<b>How to get full detailed API definitions? </b> Currently, the JavaScript Client Library shares almost the same API definitions with Node.js SDK, besides Node.js runtime specific APIs.
Please check API details on <a href="http://azure.github.io/azure-storage-node/">Azure Storage API reference documents</a>. The JavaScript global variable <code>AzureStorage.File</code> is just like the object <code>require('azure-storage')</code> returns in Node.js, but limits to File related interfaces.
Go to <a href="https://azure.github.io/azure-storage-node/FileService.html">FileService</a> to view possible methods provided by <code>FileService</code> class.
</div>
</div>
<div class="panel panel-danger">
@@ -265,15 +265,13 @@ fileService.deleteFileIfExists('myfileshare', 'mydirectory', 'myfile', function(
<h3 id="step6">Step 6: Creating your JavaScript Application based on Azure Storage JavaScript Client Library</h3>
<ul>
<li>1. Setting CORS rules for your selected Azure-Storage account file service.</li>
<li>2. Including "azure-storage.common.js" in the html file.</li>
<li>3. Including functional file(s) needed, such as "azure-storage.file.js" for file operation.</li>
<li>4. Using keyword "AzureStorage" to access to Azure storage JavaScript APIs.</li>
<li>5. Referring to <a href="http://azure.github.io/azure-storage-node/">Azure Storage Node.js SDK documents</a> for detailed API definitions which keep same with JavaScript APIs.</li>
<li>2. Including functional file(s) needed, such as "azure-storage.file.js" for file operation.</li>
<li>3. Using keyword "AzureStorage.File" to access to Azure storage JavaScript APIs for files.</li>
<li>4. Referring to <a href="http://azure.github.io/azure-storage-node/">API documents</a> for detailed API definitions.</li>
</ul>
<p> You can view the source code of this sample for detailed reference. </p>
</div>
<script src="../bundle/azure-storage.common.js"></script>
<script src="../bundle/azure-storage.file.js"></script>
<script>
@@ -307,7 +305,7 @@ fileService.deleteFileIfExists('myfileshare', 'mydirectory', 'myfile', function(
return null;
fileUri = 'https://' + account + '.file.core.windows.net';
var fileService = AzureStorage.createFileServiceWithSas(fileUri, sas).withFilter(new AzureStorage.ExponentialRetryPolicyFilter());
var fileService = AzureStorage.File.createFileServiceWithSas(fileUri, sas).withFilter(new AzureStorage.File.ExponentialRetryPolicyFilter());
return fileService;
}
@@ -371,7 +369,7 @@ fileService.deleteFileIfExists('myfileshare', 'mydirectory', 'myfile', function(
return;
var share = document.getElementById('newfileshare').value;
if (!AzureStorage.Validate.shareNameIsValid(share, function(err, res){})) {
if (!AzureStorage.File.Validate.shareNameIsValid(share, function(err, res){})) {
alert('Invalid share name!');
return;
}
+16 -19
View File
@@ -19,7 +19,7 @@
<div class="panel panel-danger">
<div class="panel-body">
<b>Note</b>: You may need set up a HTTP server to host this sample for IE browser, because IndexedDB is only available on websites with http or https URL schemes in IE. Azure Storage JavaScript Client Library currently depends on IndexedDB.
<b>Note</b>: You may need set up a HTTP server to host this sample for IE11 and latest Chrome.
</div>
</div>
@@ -42,10 +42,9 @@
<h2 id="step2">Step 2: Importing Azure Storage JavaScript Client Library</h2>
<p>
Importing <code>azure-storage.common.js</code> and <code>azure-storage.queue.js</code> in your HTML file for queue operations, and make sure <code>azure-storage.common.js</code> is in front of <code>azure-storage.queue.js</code>.
Importing <code>azure-storage.queue.js</code> in your HTML file for queue operations.
<p>
<pre>
&lt;script src="azure-storage.common.js"&gt;&lt;/script&gt;
&lt;script src="azure-storage.queue.js"&gt;&lt;/script&gt;
</pre>
@@ -56,15 +55,16 @@
</p>
<pre>
var queueUri = 'https://' + 'STORAGE_ACCOUNT' + '.queue.core.windows.net';
var queueService = AzureStorage.createQueueServiceWithSas(queueUri, 'SAS_TOKEN');
var queueService = AzureStorage.Queue.createQueueServiceWithSas(queueUri, 'SAS_TOKEN');
</pre>
<p>
In Azure Storage JavaScript Client Library, a global variable <code>AzureStorage</code> is the start point where we can create service objects for blob/table/queue/file and access to the storage utilities.
You can load Azure Storage JavaScript Client Library in a CommonJS or AMD environment by JavaScript module loaders. If no module system is found, global variable <code>AzureStorage.Queue</code> will be set, which is the start point where we can create service objects for queue and access to the storage utilities.
</p>
<div class="panel panel-primary">
<div class="panel-body">
<b>How to get full detailed API definitions? </b> Currently, the JavaScript Client Library shares the same API definitions with Node.js SDK.
Please check API details on <a href="http://azure.github.io/azure-storage-node/">Azure Storage Node.js API reference documents</a>. The JavaScript global variable <code>AzureStorage</code> is just like the object <code>require('azure-storage')</code> returns in Node.js.
<b>How to get full detailed API definitions? </b> Currently, the JavaScript Client Library shares almost the same API definitions with Node.js SDK, besides Node.js runtime specific APIs.
Please check API details on <a href="http://azure.github.io/azure-storage-node/">Azure Storage API reference documents</a>. The JavaScript global variable <code>AzureStorage.Queue</code> is just like the object <code>require('azure-storage')</code> returns in Node.js, but limits to Queue related interfaces.
Go to <a href="https://azure.github.io/azure-storage-node/QueueService.html">QueueService</a> to view possible methods provided by <code>QueueService</code> class.
</div>
</div>
<div class="panel panel-danger">
@@ -136,7 +136,7 @@ queueService.deleteQueueIfExists('myqueue', function(error, result) {
<p> A storage <b>Message</b>, in any format, of up to 64 KB. The maximum time that a message can remain in the queue is 7 days.</p>
<div class="panel panel-primary">
<div class="panel-body">
<b>Note: </b> Azure Storage JavaScript Client Library provides <code>var encoder = new AzureStorage.QueueMessageEncoder.TextBase64QueueMessageEncoder()</code> which is a Base64 encoder and docoder.
<b>Note: </b> Azure Storage JavaScript Client Library provides <code>var encoder = new AzureStorage.Queue.QueueMessageEncoder.TextBase64QueueMessageEncoder()</code> which is a Base64 encoder and docoder.
If a message content string is encoded with <code>encoder.encode()</code>, remember to decode it with <code>encoder.decode()</code> after peek the message.
</div>
</div>
@@ -158,7 +158,7 @@ queueService.peekMessages('myqueue', {numOfMessages: 32}, function (error, resul
<h3>Create Message</h3>
<p><code>QueueService</code> provides <code>createMessage</code> for creating a new message to a queue.</p>
<pre>
var encoder = new AzureStorage.QueueMessageEncoder.TextBase64QueueMessageEncoder();
var encoder = new AzureStorage.Queue.QueueMessageEncoder.TextBase64QueueMessageEncoder();
queueService.createMessage('myqueue', encoder.encode('mymessage'), function (error, results, response) {
if (error) {
// Create message error
@@ -187,7 +187,7 @@ queueService.getMessages('myqueue', function(error, result, response) {
<h3>Update Message</h3>
<p><code>QueueService</code> provides <code>getMessages</code> and <code>updateMessage</code> for updating next message in a queue.</p>
<pre>
var encoder = new AzureStorage.QueueMessageEncoder.TextBase64QueueMessageEncoder();
var encoder = new AzureStorage.Queue.QueueMessageEncoder.TextBase64QueueMessageEncoder();
queueService.getMessages('myqueue', function(error, result, response) {
if(!error){
// Got the message
@@ -219,23 +219,20 @@ queueService.getMessages('myqueue', function(error, result, response) {
<h2 id="step6">Step 6: Creating your JavaScript Application based on Azure Storage JavaScript Client Library</h2>
<ul>
<li>1. Setting CORS rules for your selected Azure-Storage account queue service.</li>
<li>2. Including "azure-storage.common.js" in the html file.</li>
<li>3. Including functional file(s) needed, such as "azure-storage.queue.js" for queue operation.</li>
<li>4. Using keyword "AzureStorage" to access to Azure storage JavaScript APIs.</li>
<li>5. Referring to <a href="http://azure.github.io/azure-storage-node/">Azure Storage Node.js SDK documents</a> for detailed API definitions which keep same with JavaScript APIs.</li>
<li>2. Including functional file(s) needed, such as "azure-storage.queue.js" for queue operation.</li>
<li>3. Using keyword "AzureStorage.Queue" to access to Azure storage JavaScript APIs for queues.</li>
<li>4. Referring to <a href="http://azure.github.io/azure-storage-node/">API documents</a> for detailed API definitions.</li>
</ul>
<p> You can view the source code of this sample for detailed reference. </p>
</div>
<!-- azure-storage.common.js also exports Node.js module stream, util and buffer -->
<script src="../bundle/azure-storage.common.js"></script>
<script src="../bundle/azure-storage.queue.js"></script>
<script>
var account = document.getElementById('account').value;
var sas = document.getElementById('sas').value;
var queue = '';
var queueUri = '';
var encoder = new AzureStorage.QueueMessageEncoder.TextBase64QueueMessageEncoder();
var encoder = new AzureStorage.Queue.QueueMessageEncoder.TextBase64QueueMessageEncoder();
function checkParameters() {
account = document.getElementById('account').value;
@@ -260,7 +257,7 @@ queueService.getMessages('myqueue', function(error, result, response) {
return null;
queueUri = 'https://' + account + '.queue.core.windows.net';
var queueService = AzureStorage.createQueueServiceWithSas(queueUri, sas).withFilter(new AzureStorage.ExponentialRetryPolicyFilter());
var queueService = AzureStorage.Queue.createQueueServiceWithSas(queueUri, sas).withFilter(new AzureStorage.Queue.ExponentialRetryPolicyFilter());
return queueService;
}
@@ -304,7 +301,7 @@ queueService.getMessages('myqueue', function(error, result, response) {
return;
var queue = document.getElementById('newqueue').value;
if (!AzureStorage.Validate.queueNameIsValid(queue, function(err, res){})) {
if (!AzureStorage.Queue.Validate.queueNameIsValid(queue, function(err, res){})) {
alert('Invalid queue name!');
return;
}
+14 -17
View File
@@ -19,7 +19,7 @@
<div class="panel panel-danger">
<div class="panel-body">
<b>Note</b>: You may need set up a HTTP server to host this sample for IE browser, because IndexedDB is only available on websites with http or https URL schemes in IE. Azure Storage JavaScript Client Library currently depends on IndexedDB.
<b>Note</b>: You may need set up a HTTP server to host this sample for IE11 and latest Chrome.
</div>
</div>
@@ -42,10 +42,9 @@
<h2 id="step2">Step 2: Importing Azure Storage JavaScript Client Library</h2>
<p>
Importing <code>azure-storage.common.js</code> and <code>azure-storage.table.js</code> in your HTML file for table operations, and make sure <code>azure-storage.common.js</code> is in front of <code>azure-storage.table.js</code>.
Importing <code>azure-storage.table.js</code> in your HTML file for table operations.
<p>
<pre>
&lt;script src="azure-storage.common.js"&gt;&lt;/script&gt;
&lt;script src="azure-storage.table.js"&gt;&lt;/script&gt;
</pre>
@@ -56,15 +55,16 @@
</p>
<pre>
var tableUri = 'https://' + 'STORAGE_ACCOUNT' + '.table.core.windows.net';
var tableService = AzureStorage.createTableServiceWithSas(tableUri, 'SAS_TOKEN');
var tableService = AzureStorage.Table.createTableServiceWithSas(tableUri, 'SAS_TOKEN');
</pre>
<p>
In Azure Storage JavaScript Client Library, a global variable <code>AzureStorage</code> is the start point where we can create service objects for blob/table/queue/file and access to the storage utilities.
You can load Azure Storage JavaScript Client Library in a CommonJS or AMD environment by JavaScript module loaders. If no module system is found, global variable <code>AzureStorage.Table</code> will be set, which is the start point where we can create service objects for table and access to the storage utilities.
</p>
<div class="panel panel-primary">
<div class="panel-body">
<b>How to get full detailed API definitions? </b> Currently, the JavaScript Client Library shares the same API definitions with Node.js SDK.
Please check API details on <a href="http://azure.github.io/azure-storage-node/">Azure Storage Node.js API reference documents</a>. The JavaScript global variable <code>AzureStorage</code> is just like the object <code>require('azure-storage')</code> returns in Node.js.
<b>How to get full detailed API definitions? </b> Currently, the JavaScript Client Library shares almost the same API definitions with Node.js SDK, besides Node.js runtime specific APIs.
Please check API details on <a href="http://azure.github.io/azure-storage-node/">Azure Storage API reference documents</a>. The JavaScript global variable <code>AzureStorage.Table</code> is just like the object <code>require('azure-storage')</code> returns in Node.js, but limits to Table related interfaces.
Go to <a href="https://azure.github.io/azure-storage-node/TableService.html">TableService</a> to view possible methods provided by <code>TableService</code> class.
</div>
</div>
<div class="panel panel-danger">
@@ -139,7 +139,7 @@ tableService.deleteTableIfExists('mytable', function(error, result) {
<h3>Query Entities</h3>
<p><code>TableService</code> provides <code>queryEntities</code> for querying a table under a storage account.</p>
<pre>
var tableQuery = new AzureStorage.TableQuery().top(200);
var tableQuery = new AzureStorage.Table.TableQuery().top(200);
tableService.queryEntities('mytable', tableQuery, null, function(error, result) {
if (error) {
// Query entities error
@@ -204,16 +204,13 @@ tableService.deleteEntity('mytable', deleteEntity, function(error, result, respo
<h3 id="step6">Step 6: Creating your JavaScript Application based on Azure Storage JavaScript Client Library</h3>
<ul>
<li>1. Setting CORS rules for your selected Azure-Storage account table service.</li>
<li>2. Including "azure-storage.common.js" in the html file.</li>
<li>3. Including functional file(s) needed, such as "azure-storage.table.js" for table operation.</li>
<li>4. Using keyword "AzureStorage" to access to Azure storage JavaScript APIs.</li>
<li>5. Referring to <a href="http://azure.github.io/azure-storage-node/">Azure Storage Node.js SDK documents</a> for detailed API definitions which keep same with JavaScript APIs.</li>
<li>2. Including functional file(s) needed, such as "azure-storage.table.js" for table operation.</li>
<li>3. Using keyword "AzureStorage.Table" to access to Azure storage JavaScript APIs for tables.</li>
<li>4. Referring to <a href="http://azure.github.io/azure-storage-node/">API documents</a> for detailed API definitions.</li>
</ul>
<p> You can view the source code of this sample for detailed reference. </p>
</div>
<!-- azure-storage.common.js also exports Node.js module stream, util and buffer -->
<script src="../bundle/azure-storage.common.js"></script>
<script src="../bundle/azure-storage.table.js"></script>
<script>
@@ -245,7 +242,7 @@ tableService.deleteEntity('mytable', deleteEntity, function(error, result, respo
return null;
tableUri = 'https://' + account + '.table.core.windows.net';
var tableService = AzureStorage.createTableServiceWithSas(tableUri, sas).withFilter(new AzureStorage.ExponentialRetryPolicyFilter());
var tableService = AzureStorage.Table.createTableServiceWithSas(tableUri, sas).withFilter(new AzureStorage.Table.ExponentialRetryPolicyFilter());
return tableService;
}
@@ -287,7 +284,7 @@ tableService.deleteEntity('mytable', deleteEntity, function(error, result, respo
return;
var table = document.getElementById('newtable').value;
if (!AzureStorage.Validate.tableNameIsValid(table, function(err, res){})) {
if (!AzureStorage.Table.Validate.tableNameIsValid(table, function(err, res){})) {
alert('Invalid table name!');
return;
}
@@ -335,7 +332,7 @@ tableService.deleteEntity('mytable', deleteEntity, function(error, result, respo
}
document.getElementById('result').innerHTML = 'Loading table entities...';
var tableQuery = new AzureStorage.TableQuery().top(200);
var tableQuery = new AzureStorage.Table.TableQuery().top(200);
tableService.queryEntities(table, tableQuery, null, function(error, results) {
if (error) {
alert('List table entities error, please open browser console to view detailed error');
+411
View File
@@ -0,0 +1,411 @@
//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
var assert = require('assert');
var TestSuite = require('../../../test/framework/test-suite');
var testUtil = require('../../../test/framework/util');
var suite = new TestSuite('blobservice-upload-browser');
if (testUtil.isBrowser()) {
var azure = AzureStorage.Blob;
var containerNamesPrefix = 'upload-test-container-';
var blobNamesPrefix = 'upload-teset-blob-';
var containerName;
var blobName;
describe('BlobServiceUpload', function () {
before(function (done) {
blobService = azure.createBlobService(process.env['AZURE_STORAGE_CONNECTION_STRING']);
assert.notEqual(null, blobService, 'blobService should not be null');
containerName = suite.getName(containerNamesPrefix);
blobService.createContainerIfNotExists(containerName, function (err) {
assert.equal(err, null);
done();
});
});
after(function (done) {
blobService.deleteContainerIfExists(containerName, function (err) {
assert.equal(err, null);
done();
});
});
beforeEach(function () {
blobName = suite.getName(blobNamesPrefix);
});
afterEach(function () {
});
describe('createBlockBlobFromBrowserFile', function () {
it('upload block blob with invalid type should not work', function () {
try {
blobService.createBlockBlobFromBrowserFile(containerName, blobName, 'abcde', function (err, res, resp) { });
} catch (e) {
assert.notEqual(e, null);
}
});
it('upload block blob with md5 calculation should work', function (done) {
var size = 7 * 1024 * 1024;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createBlockBlobFromBrowserFile(containerName, blobName, file, { storeBlobContentMD5: true }, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
assert.notEqual(res.contentSettings.contentMD5, null);
done();
});
});
});
it('upload block blob with 0 bytes should work', function (done) {
var size = 0;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createBlockBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.blobType, AzureStorage.Blob.Constants.BlobConstants.BlobTypes.BLOCK);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
done();
});
});
});
it('upload block blob with 4 * 1024 * 1024 - 1 bytes should work', function (done) {
var size = 4 * 1024 * 1024 - 1;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createBlockBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
done();
});
});
});
it('upload block blob with 4 * 1024 * 1024 bytes should work', function (done) {
var size = 4 * 1024 * 1024;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createBlockBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
done();
});
});
});
it('upload block blob with 4 * 1024 * 1024 + 1 bytes should work', function (done) {
var size = 4 * 1024 * 1024 + 1;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createBlockBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
done();
});
});
});
it('upload block blob with 128 * 1024 * 1024 bytes should work', function (done) {
var size = 128 * 1024 * 1024;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createBlockBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
done();
});
});
});
});
describe('createPageBlobFromBrowserFile', function () {
it('upload page blob with invalid type should not work', function () {
try {
blobService.createPageBlobFromBrowserFile(containerName, blobName, 'abcde', function (err, res, resp) { });
} catch (e) {
assert.notEqual(e, null);
}
});
it('upload page blob with md5 calculation should work', function (done) {
var size = 3 * 1024 * 1024;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createPageBlobFromBrowserFile(containerName, blobName, file, { storeBlobContentMD5: true }, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
assert.notEqual(res.contentSettings.contentMD5, null);
done();
});
});
});
it('upload page blob with 0 bytes should work', function (done) {
var file = testUtil.getBrowserFile(blobName, 0);
blobService.createPageBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.blobType, AzureStorage.Blob.Constants.BlobConstants.BlobTypes.PAGE);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, 0);
done();
});
});
});
it('upload page blob with 4 * 1024 * 1024 - 1 bytes should not work', function () {
var size = 4 * 1024 * 1024 - 1;
var file = testUtil.getBrowserFile(blobName, size);
try {
blobService.createPageBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) { });
} catch (e) {
assert.notEqual(e, null);
}
});
it('upload page blob with 4 * 1024 * 1024 bytes should work', function (done) {
var size = 4 * 1024 * 1024;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createPageBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
done();
});
});
});
it('upload page blob with 128 * 1024 * 1024 bytes should work', function (done) {
var size = 128 * 1024 * 1024;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createPageBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
done();
});
});
});
});
describe('createAppendBlobFromBrowserFile', function () {
it('upload append blob with invalid type should not work', function () {
try {
blobService.createAppendBlobFromBrowserFile(containerName, blobName, 'abcde', function (err, res, resp) { });
} catch (e) {
assert.notEqual(e, null);
}
});
it('upload append blob with md5 calculation should work', function (done) {
var size = 7 * 1024 * 1024;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createAppendBlobFromBrowserFile(containerName, blobName, file, { storeBlobContentMD5: true }, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
assert.notEqual(res.contentSettings.contentMD5, null);
done();
});
});
});
it('upload append blob with 0 bytes should work', function (done) {
var file = testUtil.getBrowserFile(blobName, 0);
blobService.createAppendBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.blobType, AzureStorage.Blob.Constants.BlobConstants.BlobTypes.APPEND);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, 0);
done();
});
});
});
it('upload append blob with 4 * 1024 * 1024 - 1 bytes should work', function (done) {
var size = 4 * 1024 * 1024 - 1;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createAppendBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
done();
});
});
});
it('upload append blob with 4 * 1024 * 1024 bytes should work', function (done) {
var size = 4 * 1024 * 1024;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createAppendBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
done();
});
});
});
it('upload append blob with 4 * 1024 * 1024 + 1 bytes should work', function (done) {
var size = 4 * 1024 * 1024 + 1;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createAppendBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
done();
});
});
});
it('upload append blob with 128 * 1024 * 1024 bytes should work', function (done) {
var size = 128 * 1024 * 1024;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createAppendBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
done();
});
});
});
});
describe('appendFromBrowserFile', function () {
beforeEach(function (done) {
var size = 2 * 1024 * 1024;
var file = testUtil.getBrowserFile(blobName, size);
blobService.createAppendBlobFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size);
done();
});
});
});
it('append blob with 0 bytes should work', function (done) {
var file = testUtil.getBrowserFile(blobName, 0);
blobService.appendFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.blobType, AzureStorage.Blob.Constants.BlobConstants.BlobTypes.APPEND);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, 2 * 1024 * 1024);
done();
});
});
});
it('append blob with 4 * 1024 * 1024 - 1 bytes should work', function (done) {
var size = 4 * 1024 * 1024 - 1;
var file = testUtil.getBrowserFile(blobName, size);
blobService.appendFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size + 2 * 1024 * 1024);
done();
});
});
});
it('append blob with 4 * 1024 * 1024 bytes should work', function (done) {
var size = 4 * 1024 * 1024;
var file = testUtil.getBrowserFile(blobName, size);
blobService.appendFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size + 2 * 1024 * 1024);
done();
});
});
});
it('append blob with 4 * 1024 * 1024 + 1 bytes should work', function (done) {
var size = 4 * 1024 * 1024 + 1;
var file = testUtil.getBrowserFile(blobName, size);
blobService.appendFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size + 2 * 1024 * 1024);
done();
});
});
});
it('append blob with 128 * 1024 * 1024 bytes should work', function (done) {
var size = 128 * 1024 * 1024;
var file = testUtil.getBrowserFile(blobName, size);
blobService.appendFromBrowserFile(containerName, blobName, file, function (err, res, resp) {
assert.equal(err, null);
blobService.getBlobProperties(containerName, blobName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, blobName);
assert.equal(res.contentLength, size + 2 * 1024 * 1024);
done();
});
});
});
});
});
}
+62
View File
@@ -0,0 +1,62 @@
//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
var browserify = require('browserify');
var fs = require('fs');
var path = require('path');
var bs = browserify([
path.resolve(__dirname, '../../test/services/queue/queueservice-tests.js'),
path.resolve(__dirname, '../../test/services/table/tablebatch-tests.js'),
path.resolve(__dirname, '../../test/services/table/tabledatatype-tests.js'),
path.resolve(__dirname, '../../test/services/table/tablepayload-tests.js'),
path.resolve(__dirname, '../../test/services/table/tablequery-tests.js'),
path.resolve(__dirname, '../../test/services/table/tableservice-gb-tests.js'),
path.resolve(__dirname, '../../test/services/table/tableservice-tests.js'),
path.resolve(__dirname, '../../test/services/blob/blobservice-archive-tests.js'),
path.resolve(__dirname, '../../test/services/blob/blobservice-container-tests.js'),
path.resolve(__dirname, '../../test/services/blob/blobservice-lease-tests.js'),
path.resolve(__dirname, '../../test/services/blob/blobservice-sse-tests.js'),
path.resolve(__dirname, '../../test/services/blob/blobservice-tests.js'),
path.resolve(__dirname, '../../test/services/blob/blobservice-uploaddownload-tests.js'),
path.resolve(__dirname, '../../test/services/file/fileservice-directory-tests.js'),
path.resolve(__dirname, '../../test/services/file/fileservice-file-tests.js'),
path.resolve(__dirname, '../../test/services/file/fileservice-share-tests.js'),
path.resolve(__dirname, '../../test/services/file/fileservice-sharesnapshot-tests.js'),
path.resolve(__dirname, '../../test/services/file/fileservice-sse-tests.js'),
path.resolve(__dirname, '../../test/services/file/fileservice-tests.js'),
path.resolve(__dirname, '../../test/services/file/fileservice-uploaddownload-tests.js'),
path.resolve(__dirname, '../../test/common/connectionstringparsertests.js'),
path.resolve(__dirname, '../../test/common/secondarytests.js'),
path.resolve(__dirname, '../../test/common/servicesettingstests.js'),
path.resolve(__dirname, '../../test/common/servicestatstests.js'),
path.resolve(__dirname, '../../test/common/sharedkey-tests.js'),
path.resolve(__dirname, '../../test/common/storageserviceclienttests.js'),
path.resolve(__dirname, '../../test/common/storageservicesettingstests.js'),
path.resolve(__dirname, '../../test/common/filters/exponentialretrypolicyfilter-tests.js'),
path.resolve(__dirname, '../../test/common/filters/linearretrypolicyfilter-tests.js'),
path.resolve(__dirname, '../../test/common/util/iso8061date-tests.js'),
path.resolve(__dirname, '../../test/common/util/util-tests.js'),
path.resolve(__dirname, '../../test/common/util/validate-tests.js'),
path.resolve(__dirname, '../../test/azure-tests.js'),
path.resolve(__dirname, '../../test/accountsas-tests.js'),
path.resolve(__dirname, './file/fileservice-upload.js'),
path.resolve(__dirname, './blob/blobservice-upload.js')
], { require: ['https'] }).bundle();
bs.pipe(
fs.createWriteStream(path.resolve(__dirname, './browser.tests.bundled.js'))
);
+155
View File
@@ -0,0 +1,155 @@
//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
var assert = require('assert');
var TestSuite = require('../../../test/framework/test-suite');
var testUtil = require('../../../test/framework/util');
var suite = new TestSuite('fileservice-upload-browser');
if (testUtil.isBrowser()) {
var azure = AzureStorage.File;
var shareNamesPrefix = 'upload-test-share-';
var fileNamesPrefix = 'upload-test-file-';
var shareName;
var fileName;
describe('FileServiceUpload', function () {
before(function (done) {
fileService = azure.createFileService(process.env['AZURE_STORAGE_CONNECTION_STRING']);
assert.notEqual(null, fileService, 'FileService should not be null');
shareName = suite.getName(shareNamesPrefix);
fileService.createShareIfNotExists(shareName, function (err) {
assert.equal(err, null);
done();
});
});
after(function (done) {
fileService.deleteShareIfExists(shareName, function (err) {
assert.equal(err, null);
done();
});
});
beforeEach(function () {
fileName = suite.getName(fileNamesPrefix);
});
afterEach(function (done) {
fileService.deleteFileIfExists(shareName, '', fileName, function (err) {
assert.equal(err, null);
done();
});
});
describe('createFileFromBrowserFile', function () {
it('upload file with invalid type should not work', function () {
try {
fileService.createFileFromBrowserFile(shareName, '', fileName, 'abcde', function (err, res, resp) {});
} catch (e) {
assert.notEqual(e, null);
}
});
it('upload file with md5 calculation should work', function (done) {
var size = 33 * 1024 * 1024;
var file = testUtil.getBrowserFile(fileName, size);
fileService.createFileFromBrowserFile(shareName, '', fileName, file, { storeFileContentMD5: true}, function (err, res, resp) {
assert.equal(err, null);
fileService.getFileProperties(shareName, '', fileName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, fileName);
assert.equal(res.contentLength, size);
assert.notEqual(res.contentSettings.contentMD5, null);
done();
});
});
});
it('upload file with 0 bytes should work', function (done) {
var file = testUtil.getBrowserFile(fileName, 0);
fileService.createFileFromBrowserFile(shareName, '', fileName, file, function (err, res, resp) {
assert.equal(err, null);
fileService.getFileProperties(shareName, '', fileName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, fileName);
assert.equal(res.contentLength, 0);
done();
});
});
});
it('upload file with 4 * 1024 * 1024 - 1 bytes should work', function (done) {
var size = 4 * 1024 * 1024 - 1;
var file = testUtil.getBrowserFile(fileName, size);
fileService.createFileFromBrowserFile(shareName, '', fileName, file, function (err, res, resp) {
assert.equal(err, null);
fileService.getFileProperties(shareName, '', fileName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, fileName);
assert.equal(res.contentLength, size);
done();
});
});
});
it('upload file with 4 * 1024 * 1024 bytes should work', function (done) {
var size = 4 * 1024 * 1024;
var file = testUtil.getBrowserFile(fileName, size);
fileService.createFileFromBrowserFile(shareName, '', fileName, file, function (err, res, resp) {
assert.equal(err, null);
fileService.getFileProperties(shareName, '', fileName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, fileName);
assert.equal(res.contentLength, size);
done();
});
});
});
it('upload file with 4 * 1024 * 1024 + 1 bytes should work', function (done) {
var size = 4 * 1024 * 1024 + 1;
var file = testUtil.getBrowserFile(fileName, size);
fileService.createFileFromBrowserFile(shareName, '', fileName, file, function (err, res, resp) {
assert.equal(err, null);
fileService.getFileProperties(shareName, '', fileName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, fileName);
assert.equal(res.contentLength, size);
done();
});
});
});
it('upload file with 128 * 1024 * 1024 bytes should work', function (done) {
var size = 128 * 1024 * 1024;
var file = testUtil.getBrowserFile(fileName, size);
fileService.createFileFromBrowserFile(shareName, '', fileName, file, function (err, res, resp) {
assert.equal(err, null);
fileService.getFileProperties(shareName, '', fileName, function (err, res) {
assert.equal(err, null);
assert.equal(res.name, fileName);
assert.equal(res.contentLength, size);
done();
});
});
});
});
});
}