Created
June 23, 2012 21:23
-
-
Save pofallon/2980063 to your computer and use it in GitHub Desktop.
Timed test of BlobReadStream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* To run this example: | |
* | |
* - Save this file as test.js | |
* - Run 'npm install azure' and 'npm install bluesky' | |
* - Set the variables 'myAccount' and 'myKey' to your Azure storage credentials | |
* - Set the 'containerName' and 'blobName' variables to an existing blob in Azure storage | |
* - Run as 'node test.js' | |
* | |
* The BlobReadStream source can be found here: | |
* https://github.com/pofallon/node-bluesky/blob/master/lib/blobReadStream.js | |
* | |
*/ | |
var myAccount = ''; | |
var myKey = ''; | |
var containerName = ''; | |
var blobName = ''; | |
var azure = require('azure'); | |
var blobService = azure.createBlobService(myAccount,myKey); | |
var BlobReadStream = require('bluesky/lib/blobReadStream'); | |
var readStream = new BlobReadStream(); | |
var d1 = Date.now(); | |
readStream.on('end', function() { | |
console.log('TEST: End (+' + (Date.now() - d1) + ' ms)'); | |
}); | |
readStream.on('data', function(data) { | |
console.log('TEST: Data: ' + data + ' (+' + (Date.now() - d1) + ' ms)'); | |
}); | |
console.log('TEST: Calling getBlobToStream (+' + (Date.now() - d1) + ' ms)'); | |
var d1 = Date.now(); | |
blobService.getBlobToStream(containerName, blobName, readStream, function(err, blobResult) { | |
console.log('TEST: Callback invoked (+' + (Date.now() - d1) + ' ms)'); | |
readStream.ready(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment