Storage Client Library 0.8.0
This commit is contained in:
Родитель
f548c06a49
Коммит
544b20a8f4
|
@ -1,6 +1,15 @@
|
|||
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 CTP v1 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.
|
||||
|
||||
2016.01 Version 0.8.0
|
||||
|
||||
ALL
|
||||
* Preview release of the TypeScript definition file at "lib/azure-storage.d.ts".
|
||||
|
||||
BLOB
|
||||
* Added the blob result to the callback of BlobService.commitBlocks.
|
||||
* Added the speed summary to the downloading APIs.
|
||||
|
||||
2015.12 Version 0.7.0
|
||||
|
||||
ALL
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -31,7 +31,7 @@ var Constants = {
|
|||
/*
|
||||
* Specifies the value to use for UserAgent header.
|
||||
*/
|
||||
USER_AGENT_PRODUCT_VERSION: '0.7.0',
|
||||
USER_AGENT_PRODUCT_VERSION: '0.8.0',
|
||||
|
||||
/**
|
||||
* The number of default concurrent requests for parallel operation.
|
||||
|
|
|
@ -1506,7 +1506,7 @@ BlobService.prototype.setBlobMetadata = function (container, blob, metadata, opt
|
|||
* @param {boolean} [options.skipSizeCheck] Skip the size check to perform direct download.
|
||||
* Set the option to true for small blobs.
|
||||
* Parallel download and speed summary won't work with this option on.
|
||||
* @param {SpeedSummary} [options.speedSummary] The upload tracker objects.
|
||||
* @param {SpeedSummary} [options.speedSummary] The download tracker objects.
|
||||
* @param {int} [options.parallelOperationThreadCount] Parallel operation thread count
|
||||
* @param {string} [options.snapshotId] The snapshot identifier.
|
||||
* @param {string} [options.leaseId] The lease identifier.
|
||||
|
@ -1620,6 +1620,7 @@ BlobService.prototype.createReadStream = function (container, blob, optionsOrCal
|
|||
* @param {boolean} [options.skipSizeCheck] Skip the size check to perform direct download.
|
||||
* Set the option to true for small blobs.
|
||||
* Parallel download and speed summary won't work with this option on.
|
||||
* @param {SpeedSummary} [options.speedSummary] The download tracker objects.
|
||||
* @param {string} [options.snapshotId] The snapshot identifier.
|
||||
* @param {string} [options.leaseId] The lease identifier.
|
||||
* @param {string} [options.rangeStart] Return only the bytes of the blob in the specified range.
|
||||
|
@ -1639,6 +1640,7 @@ BlobService.prototype.createReadStream = function (container, blob, optionsOrCal
|
|||
* @param {errorOrResult} callback `error` will contain information if an error occurs;
|
||||
* otherwise `result` will contain the blob information.
|
||||
* `response` will contain information related to this operation.
|
||||
* @return {SpeedSummary}
|
||||
*
|
||||
* @example
|
||||
* var azure = require('azure-storage');
|
||||
|
@ -1652,7 +1654,8 @@ BlobService.prototype.createReadStream = function (container, blob, optionsOrCal
|
|||
BlobService.prototype.getBlobToStream = function (container, blob, writeStream, optionsOrCallback, callback) {
|
||||
var userOptions;
|
||||
azureutil.normalizeArgs(optionsOrCallback, callback, function (o, c) { userOptions = o; callback = c; });
|
||||
|
||||
userOptions.speedSummary = userOptions.speedSummary || new SpeedSummary(blob);
|
||||
|
||||
validate.validateArgs('getBlobToStream', function (v) {
|
||||
v.string(container, 'container');
|
||||
v.string(blob, 'blob');
|
||||
|
@ -1685,6 +1688,8 @@ BlobService.prototype.getBlobToStream = function (container, blob, writeStream,
|
|||
} else {
|
||||
size = properties.contentLength;
|
||||
}
|
||||
options.speedSummary.totalSize = size;
|
||||
|
||||
if (size > self.singleBlobPutThresholdInBytes) {
|
||||
options.contentMD5 = properties.contentMD5;
|
||||
self._getBlobToRangeStream(container, blob, properties.blobType, writeStream, options, callback);
|
||||
|
@ -3162,7 +3167,7 @@ BlobService.prototype._createBlock = function (blockId, container, blob, content
|
|||
* The default value is false.
|
||||
* @param {errorOrResult} callback `error` will contain information
|
||||
* if an error occurs; otherwise `result` will contain
|
||||
* the blocklist information.
|
||||
* the blob result with the blocklist information.
|
||||
* `response` will contain information related to this operation.
|
||||
*/
|
||||
BlobService.prototype.commitBlocks = function (container, blob, blockList, optionsOrCallback, callback) {
|
||||
|
@ -3188,13 +3193,15 @@ BlobService.prototype.commitBlocks = function (container, blob, blockList, optio
|
|||
BlobResult.setPropertiesFromBlob(webResource, options);
|
||||
|
||||
var processResponseCallback = function (responseObject, next) {
|
||||
responseObject.list = null;
|
||||
responseObject.blobResult = new BlobResult(container, blob);
|
||||
responseObject.blobResult.list = null;
|
||||
if (!responseObject.error) {
|
||||
responseObject.list = blockList;
|
||||
responseObject.blobResult.getPropertiesFromHeaders(responseObject.response.headers);
|
||||
responseObject.blobResult.list = blockList;
|
||||
}
|
||||
|
||||
var finalCallback = function (returnObject) {
|
||||
callback(returnObject.error, returnObject.list, returnObject.response);
|
||||
callback(returnObject.error, returnObject.blobResult, returnObject.response);
|
||||
};
|
||||
|
||||
next(responseObject, finalCallback);
|
||||
|
@ -3909,7 +3916,7 @@ BlobService.prototype._createBlobFromLocalFile = function (container, blob, blob
|
|||
self._uploadBlobFromStream(true, container, blob, blobType, stream, size, options, streamCallback);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Check the file size to determine the upload method: single request or chunks
|
||||
fs.stat(localFileName, function (error, stat) {
|
||||
if (error) {
|
||||
|
@ -5172,15 +5179,15 @@ BlobService.prototype._setRangeContentMD5Header = function (webResource, options
|
|||
};
|
||||
|
||||
/**
|
||||
* Downloads a blockblob or pageblob into a range stream.
|
||||
* Downloads a blockblob, pageblob or appendblob into a range stream.
|
||||
* @ignore
|
||||
* @this {BlobService}
|
||||
* @param {string} container The container name.
|
||||
* @param {string} blob The blob name.
|
||||
* @param {string} blobType The type of blob to create: block blob or page blob.
|
||||
* @param {string} blobType The type of blob to download: block blob, page blob or append blob.
|
||||
* @param {Stream} writeStream The write stream.
|
||||
* @param {object} [options] The request options.
|
||||
* @param {SpeedSummary} [options.speedSummary] The upload tracker objects.
|
||||
* @param {SpeedSummary} [options.speedSummary] The download tracker objects.
|
||||
* @param {int} [options.parallelOperationThreadCount] Parallel operation thread count
|
||||
* @param {string} [options.snapshotId] The snapshot identifier.
|
||||
* @param {string} [options.leaseId] The lease identifier.
|
||||
|
@ -5446,6 +5453,7 @@ BlobService.prototype._getBlobToStream = function (container, blob, writeStream,
|
|||
* @param {boolean} [options.skipSizeCheck] Skip the size check to perform direct download.
|
||||
* Set the option to true for small blobs.
|
||||
* Parallel download and speed summary won't work with this option on.
|
||||
* @param {SpeedSummary} [options.speedSummary] The download tracker objects.
|
||||
* @param {string} [options.snapshotId] The snapshot identifier.
|
||||
* @param {string} [options.leaseId] The lease identifier.
|
||||
* @param {string} [options.rangeStart] Return only the bytes of the blob in the specified range.
|
||||
|
@ -5465,11 +5473,14 @@ BlobService.prototype._getBlobToStream = function (container, blob, writeStream,
|
|||
* @param {errorOrResult} callback `error` will contain information if an error occurs;
|
||||
* otherwise `result` will contain the blob information.
|
||||
* `response` will contain information related to this operation.
|
||||
* @return {SpeedSummary}
|
||||
*
|
||||
*/
|
||||
BlobService.prototype._getBlobToLocalFile = function (container, blob, localFileName, optionsOrCallback, callback) {
|
||||
var options;
|
||||
azureutil.normalizeArgs(optionsOrCallback, callback, function (o, c) { options = o; callback = c; });
|
||||
|
||||
options.speedSummary = options.speedSummary || new SpeedSummary(blob);
|
||||
|
||||
var writeStream = fs.createWriteStream(localFileName, { 'highWaterMark': BlobConstants.MAX_QUEUED_WRITE_DISK_BUFFER_SIZE });
|
||||
|
||||
this.getBlobToStream(container, blob, writeStream, options, function (error, responseBlob, response) {
|
||||
|
@ -5484,12 +5495,13 @@ BlobService.prototype._getBlobToLocalFile = function (container, blob, localFile
|
|||
fs.unlink(localFileName, function () {
|
||||
callback(error, responseBlob, response);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
callback(error, responseBlob, response);
|
||||
});
|
||||
});
|
||||
|
||||
return options.speedSummary;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -2176,6 +2176,7 @@ FileService.prototype.getFileToText = function (share, directory, file, optionsO
|
|||
* @param {boolean} [options.skipSizeCheck] Skip the size check to perform direct download.
|
||||
* Set the option to true for small files.
|
||||
* Parallel download and speed summary won't work with this option on.
|
||||
* @param {SpeedSummary} [options.speedSummary] The download tracker objects.
|
||||
* @param {string} [options.rangeStart] Return only the bytes of the file in the specified range.
|
||||
* @param {string} [options.rangeEnd] Return only the bytes of the file in the specified range.
|
||||
* @param {boolean} [options.useTransactionalMD5] When set to true, Calculate and send/validate content MD5 for transactions.
|
||||
|
@ -2192,6 +2193,8 @@ FileService.prototype.getFileToText = function (share, directory, file, optionsO
|
|||
* @param {errorOrResult} callback `error` will contain information if an error occurs;
|
||||
* otherwise `result` will contain the file information.
|
||||
* `response` will contain information related to this operation.
|
||||
* @return {SpeedSummary}
|
||||
*
|
||||
* @example
|
||||
* var azure = require('azure-storage');
|
||||
* var FileService = azure.createFileService();
|
||||
|
@ -2203,6 +2206,7 @@ FileService.prototype.getFileToText = function (share, directory, file, optionsO
|
|||
FileService.prototype.getFileToLocalFile = function (share, directory, file, localFileName, optionsOrCallback, callback) {
|
||||
var userOptions;
|
||||
azureutil.normalizeArgs(optionsOrCallback, callback, function (o, c) { userOptions = o; callback = c; });
|
||||
userOptions.speedSummary = userOptions.speedSummary || new SpeedSummary(file);
|
||||
|
||||
validate.validateArgs('getFileToLocalFile', function (v) {
|
||||
v.string(share, 'share');
|
||||
|
@ -2234,6 +2238,8 @@ FileService.prototype.getFileToLocalFile = function (share, directory, file, loc
|
|||
}
|
||||
callback(error, responseFile, response);
|
||||
});
|
||||
|
||||
return options.speedSummary;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -2306,6 +2312,7 @@ FileService.prototype.createReadStream = function (share, directory, file, optio
|
|||
* @param {boolean} [options.skipSizeCheck] Skip the size check to perform direct download.
|
||||
* Set the option to true for small files.
|
||||
* Parallel download and speed summary won't work with this option on.
|
||||
* @param {SpeedSummary} [options.speedSummary] The download tracker objects.
|
||||
* @param {string} [options.rangeStart] Return only the bytes of the file in the specified range.
|
||||
* @param {string} [options.rangeEnd] Return only the bytes of the file in the specified range.
|
||||
* @param {boolean} [options.useTransactionalMD5] When set to true, Calculate and send/validate content MD5 for transactions.
|
||||
|
@ -2322,6 +2329,8 @@ FileService.prototype.createReadStream = function (share, directory, file, optio
|
|||
* @param {errorOrResult} callback `error` will contain information if an error occurs;
|
||||
* otherwise `result` will contain the file information.
|
||||
* `response` will contain information related to this operation.
|
||||
* @return {SpeedSummary}
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var azure = require('azure-storage');
|
||||
|
@ -2335,7 +2344,8 @@ FileService.prototype.createReadStream = function (share, directory, file, optio
|
|||
FileService.prototype.getFileToStream = function (share, directory, file, writeStream, optionsOrCallback, callback) {
|
||||
var userOptions;
|
||||
azureutil.normalizeArgs(optionsOrCallback, callback, function (o, c) { userOptions = o; callback = c; });
|
||||
|
||||
userOptions.speedSummary = userOptions.speedSummary || new SpeedSummary(file);
|
||||
|
||||
validate.validateArgs('getFileToStream', function (v) {
|
||||
v.string(share, 'share');
|
||||
v.stringAllowEmpty(directory, 'directory');
|
||||
|
@ -2368,6 +2378,8 @@ FileService.prototype.getFileToStream = function (share, directory, file, writeS
|
|||
} else {
|
||||
size = properties.contentLength;
|
||||
}
|
||||
options.speedSummary.totalSize = size;
|
||||
|
||||
if (size > self.singleFileThresholdInBytes) {
|
||||
options.contentMD5 = properties.contentMD5;
|
||||
self._getFileToRangeStream(share, directory, file, writeStream, options, callback);
|
||||
|
@ -2585,7 +2597,7 @@ FileService.prototype.createRangesFromStream = function (share, directory, file,
|
|||
* @param {string} file The file name. File names may not start or end with the delimiter '/'.
|
||||
* @param {string|object} text The file text, as a string or in a Buffer.
|
||||
* @param {object} [options] The request options.
|
||||
* @param {SpeedSummary} [options.speedSummary] The download tracker objects;
|
||||
* @param {SpeedSummary} [options.speedSummary] The upload tracker objects;
|
||||
* @param {object} [options.metadata] The metadata key/value pairs.
|
||||
* @param {bool} [options.storeFileContentMD5] Specifies whether the file's ContentMD5 header should be set on uploads.
|
||||
* The default value is false for files.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "azure-storage",
|
||||
"author": "Microsoft Corporation",
|
||||
"version": "0.7.0",
|
||||
"version": "0.8.0",
|
||||
"description": "Microsoft Azure Storage Client Library for Node.js",
|
||||
"tags": [
|
||||
"azure",
|
||||
|
|
|
@ -640,8 +640,14 @@ describe('blob-uploaddownload-tests', function () {
|
|||
UncommittedBlocks: ['id2']
|
||||
};
|
||||
|
||||
blobService.commitBlocks(containerName, blobName, blockList, function (error4) {
|
||||
blobService.commitBlocks(containerName, blobName, blockList, function (error4, blob) {
|
||||
assert.equal(error4, null);
|
||||
assert.equal(blob.container, containerName);
|
||||
assert.equal(blob.blob, blobName);
|
||||
assert.deepEqual(blob.list, blockList);
|
||||
assert.notEqual(blob.etag, null);
|
||||
assert.notEqual(blob.lastModified, null);
|
||||
assert.notEqual(blob.contentMD5, null);
|
||||
|
||||
blobService.listBlocks(containerName, blobName, BlobUtilities.BlockListFilter.ALL, function (error5, list) {
|
||||
assert.equal(error5, null);
|
||||
|
@ -674,8 +680,14 @@ describe('blob-uploaddownload-tests', function () {
|
|||
LatestBlocks: ['id1'],
|
||||
};
|
||||
|
||||
blobService.commitBlocks(containerName, blobName, blockList, function (error4) {
|
||||
blobService.commitBlocks(containerName, blobName, blockList, function (error4, blob) {
|
||||
assert.equal(error4, null);
|
||||
assert.equal(blob.container, containerName);
|
||||
assert.equal(blob.blob, blobName);
|
||||
assert.deepEqual(blob.list, blockList);
|
||||
assert.notEqual(blob.etag, null);
|
||||
assert.notEqual(blob.lastModified, null);
|
||||
assert.notEqual(blob.contentMD5, null);
|
||||
|
||||
blobService.listBlocks(containerName, blobName, BlobUtilities.BlockListFilter.ALL, function (error5, list) {
|
||||
assert.equal(error5, null);
|
||||
|
@ -1250,6 +1262,34 @@ describe('blob-uploaddownload-tests', function () {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
runOrSkip('getBlobToLocalFile should return the SpeedSummary correctly', function (done) {
|
||||
var blobName = testutil.generateId(blobNamesPrefix, blobNames, suite.isMocked);
|
||||
var fileNameSource = testutil.generateId('getBlobToLocalFileSpeedSummary', [], suite.isMocked) + '.test';
|
||||
var fileSize = 97 * 1024 * 1024; // Don't be a multiple of 4MB to cover more scenarios
|
||||
generateTempFile(fileNameSource, fileSize, false, function (fileInfo) {
|
||||
uploadOptions.parallelOperationThreadCount = 5;
|
||||
blobService.createBlockBlobFromLocalFile(containerName, blobName, fileNameSource, uploadOptions, function (error) {
|
||||
assert.equal(error, null);
|
||||
|
||||
var speedSummary;
|
||||
var downloadOptions = {
|
||||
parallelOperationThreadCount : 5
|
||||
};
|
||||
|
||||
speedSummary = blobService.getBlobToLocalFile(containerName, blobName, fileNameSource, downloadOptions, function (error) {
|
||||
assert.equal(speedSummary.getTotalSize(false), fileSize);
|
||||
assert.equal(speedSummary.getCompleteSize(false), fileSize);
|
||||
assert.equal(speedSummary.getCompletePercent(), '100.0');
|
||||
|
||||
try { fs.unlinkSync(fileNameSource); } catch (e) { }
|
||||
done();
|
||||
});
|
||||
|
||||
assert.notEqual(speedSummary, null);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
runOrSkip('should have same md5 with range-based downloading to stream', function (done) {
|
||||
var blobName = testutil.generateId(blobNamesPrefix, blobNames, suite.isMocked);
|
||||
|
|
|
@ -614,6 +614,38 @@ describe('FileUploadDownload', function () {
|
|||
});
|
||||
});
|
||||
|
||||
runOrSkip('should return speedSummary correctly', function(done) {
|
||||
var size = 99*1024*1024; // Do not use a multiple of 4MB size
|
||||
generateTempFile(localLargeFileName, size, false, function (fileInfo) {
|
||||
var uploadOptions = {
|
||||
storeBlobContentMD5: true,
|
||||
parallelOperationThreadCount: 5
|
||||
};
|
||||
|
||||
fileService.createFileFromLocalFile(shareName, directoryName, fileName, localLargeFileName, uploadOptions, function (err) {
|
||||
assert.equal(err, null);
|
||||
|
||||
var speedSummary;
|
||||
var downloadOptions = {
|
||||
useTransactionalMD5: true,
|
||||
parallelOperationThreadCount: 5
|
||||
};
|
||||
|
||||
speedSummary = fileService.getFileToLocalFile(shareName, directoryName, fileName, downloadFileName, downloadOptions, function (err, file) {
|
||||
assert.equal(err, null);
|
||||
|
||||
assert.equal(speedSummary.getTotalSize(false), size);
|
||||
assert.equal(speedSummary.getCompleteSize(false), size);
|
||||
assert.equal(speedSummary.getCompletePercent(), '100.0');
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
assert.notEqual(speedSummary, null);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should calculate content md5', function(done) {
|
||||
fileContentMD5 = writeFile(localFileName, fileText);
|
||||
fileService.createFileFromLocalFile(shareName, directoryName, fileName, localFileName, {storeFileContentMD5: true}, function (err) {
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,147 @@
|
|||
// Type definitions for mocha 2.0.1
|
||||
// Project: http://mochajs.org/
|
||||
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>, otiai10 <https://github.com/otiai10>, jt000 <https://github.com/jt000>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Mocha {
|
||||
// Setup mocha with the given setting options.
|
||||
setup(options: MochaSetupOptions): Mocha;
|
||||
|
||||
//Run tests and invoke `fn()` when complete.
|
||||
run(callback?: () => void): void;
|
||||
|
||||
// Set reporter as function
|
||||
reporter(reporter: () => void): Mocha;
|
||||
|
||||
// Set reporter, defaults to "dot"
|
||||
reporter(reporter: string): Mocha;
|
||||
|
||||
// Enable growl support.
|
||||
growl(): Mocha
|
||||
}
|
||||
|
||||
interface MochaSetupOptions {
|
||||
//milliseconds to wait before considering a test slow
|
||||
slow?: number;
|
||||
|
||||
// timeout in milliseconds
|
||||
timeout?: number;
|
||||
|
||||
// ui name "bdd", "tdd", "exports" etc
|
||||
ui?: string;
|
||||
|
||||
//array of accepted globals
|
||||
globals?: any[];
|
||||
|
||||
// reporter instance (function or string), defaults to `mocha.reporters.Dot`
|
||||
reporter?: any;
|
||||
|
||||
// bail on the first test failure
|
||||
bail?: Boolean;
|
||||
|
||||
// ignore global leaks
|
||||
ignoreLeaks?: Boolean;
|
||||
|
||||
// grep string or regexp to filter tests with
|
||||
grep?: any;
|
||||
}
|
||||
|
||||
interface MochaDone {
|
||||
(error?: Error): void;
|
||||
}
|
||||
|
||||
declare var mocha: Mocha;
|
||||
|
||||
declare var describe : {
|
||||
(description: string, spec: () => void): void;
|
||||
only(description: string, spec: () => void): void;
|
||||
skip(description: string, spec: () => void): void;
|
||||
timeout(ms: number): void;
|
||||
}
|
||||
|
||||
// alias for `describe`
|
||||
declare var context : {
|
||||
(contextTitle: string, spec: () => void): void;
|
||||
only(contextTitle: string, spec: () => void): void;
|
||||
skip(contextTitle: string, spec: () => void): void;
|
||||
timeout(ms: number): void;
|
||||
}
|
||||
|
||||
declare var it: {
|
||||
(expectation: string, assertion?: () => void): void;
|
||||
(expectation: string, assertion?: (done: MochaDone) => void): void;
|
||||
only(expectation: string, assertion?: () => void): void;
|
||||
only(expectation: string, assertion?: (done: MochaDone) => void): void;
|
||||
skip(expectation: string, assertion?: () => void): void;
|
||||
skip(expectation: string, assertion?: (done: MochaDone) => void): void;
|
||||
timeout(ms: number): void;
|
||||
};
|
||||
|
||||
declare function before(action: () => void): void;
|
||||
|
||||
declare function before(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function setup(action: () => void): void;
|
||||
|
||||
declare function setup(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function after(action: () => void): void;
|
||||
|
||||
declare function after(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function teardown(action: () => void): void;
|
||||
|
||||
declare function teardown(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function beforeEach(action: () => void): void;
|
||||
|
||||
declare function beforeEach(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function suiteSetup(action: () => void): void;
|
||||
|
||||
declare function suiteSetup(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function afterEach(action: () => void): void;
|
||||
|
||||
declare function afterEach(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function suiteTeardown(action: () => void): void;
|
||||
|
||||
declare function suiteTeardown(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare module "mocha" {
|
||||
|
||||
class Mocha {
|
||||
constructor(options?: {
|
||||
grep?: RegExp;
|
||||
ui?: string;
|
||||
reporter?: string;
|
||||
timeout?: number;
|
||||
bail?: boolean;
|
||||
});
|
||||
|
||||
bail(value?: boolean): Mocha;
|
||||
addFile(file: string): Mocha;
|
||||
reporter(value: string): Mocha;
|
||||
ui(value: string): Mocha;
|
||||
grep(value: string): Mocha;
|
||||
grep(value: RegExp): Mocha;
|
||||
invert(): Mocha;
|
||||
ignoreLeaks(value: boolean): Mocha;
|
||||
checkLeaks(): Mocha;
|
||||
growl(): Mocha;
|
||||
globals(value: string): Mocha;
|
||||
globals(values: string[]): Mocha;
|
||||
useColors(value: boolean): Mocha;
|
||||
useInlineDiffs(value: boolean): Mocha;
|
||||
timeout(value: number): Mocha;
|
||||
slow(value: number): Mocha;
|
||||
enableTimeouts(value: boolean): Mocha;
|
||||
asyncOnly(value: boolean): Mocha;
|
||||
noHighlighting(value: boolean): Mocha;
|
||||
|
||||
run(onComplete?: (failures: number) => void): void;
|
||||
}
|
||||
|
||||
export = Mocha;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
// Type definitions for node-uuid.js
|
||||
// Project: https://github.com/broofa/node-uuid
|
||||
// Definitions by: Jeff May <https://github.com/jeffmay>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
interface UUIDOptions {
|
||||
|
||||
/**
|
||||
* Node id as Array of 6 bytes (per 4.1.6).
|
||||
* Default: Randomly generated ID. See note 1.
|
||||
*/
|
||||
node: any[];
|
||||
|
||||
/**
|
||||
* (Number between 0 - 0x3fff) RFC clock sequence.
|
||||
* Default: An internally maintained clockseq is used.
|
||||
*/
|
||||
clockseq: number;
|
||||
|
||||
/**
|
||||
* (Number | Date) Time in milliseconds since unix Epoch.
|
||||
* Default: The current time is used.
|
||||
*/
|
||||
msecs: any;
|
||||
|
||||
/**
|
||||
* (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if msecs is unspecified.
|
||||
* Default: internal uuid counter is used, as per 4.2.1.2.
|
||||
*/
|
||||
nsecs: number;
|
||||
}
|
||||
|
||||
interface UUID {
|
||||
v1(options?: UUIDOptions, buffer?: number[], offset?: number): string;
|
||||
v1(options?: UUIDOptions, buffer?: NodeBuffer, offset?: number): string;
|
||||
|
||||
v2(options?: UUIDOptions, buffer?: number[], offset?: number): string;
|
||||
v2(options?: UUIDOptions, buffer?: NodeBuffer, offset?: number): string;
|
||||
|
||||
v3(options?: UUIDOptions, buffer?: number[], offset?: number): string;
|
||||
v3(options?: UUIDOptions, buffer?: NodeBuffer, offset?: number): string;
|
||||
|
||||
v4(options?: UUIDOptions, buffer?: number[], offset?: number): string;
|
||||
v4(options?: UUIDOptions, buffer?: NodeBuffer, offset?: number): string;
|
||||
|
||||
parse(id: string, buffer?: number[], offset?: number): void;
|
||||
parse(id: string, buffer?: Buffer, offset?: number): void;
|
||||
|
||||
unparse(buffer: number[], offset?: number);
|
||||
unparse(buffer: Buffer, offset?: number);
|
||||
}
|
||||
|
||||
declare module "node-uuid" {
|
||||
var uuid: UUID;
|
||||
export = uuid;
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче