Skip to content

Instantly share code, notes, and snippets.

@svmehta
Created March 6, 2013 23:06
Show Gist options
  • Save svmehta/5104061 to your computer and use it in GitHub Desktop.
Save svmehta/5104061 to your computer and use it in GitHub Desktop.
var azure = require ('azure')
, http = require ('http')
, conf = require ('/conf');
var blobService = azure.createBlobService(conf.azure.storageAccount, conf.azure.storageAccessKey);
http.get( 'http://1800hocking.files.wordpress.com/2011/07/hi-ohio-logo.jpg', function( response ) {
var contentLength = Number(response.headers['content-length']);
blobService.createBlockBlobFromStream (conf.azure.container, 'myImage', response, contentLength, function (err) {
console.log (err);
/*
{ [Error: The specified resource does not exist.
RequestId:12443647-c576-4b49-9a9c-c293cbd35f40
Time:2013-03-06T23:04:48.4781009Z]
code: 'ResourceNotFound',
message: 'The specified resource does not exist.\nRequestId:12443647-c576-4b49-9a9c-c293cbd35f40\nTime:2013-03-06T23:04:48.4781009Z' }
*/
})
}).on( 'error', function( err ) {
console.error (err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment