node.js - Hash mismatch (integrity check failed) with Azure Blob Storage -


i'm following http://willi.am/blog/2014/07/03/azure-blob-storage-and-node-downloading-blobs/.

however despite exact same code, when download blobs azure gives error:

[error: hash mismatch (integrity check failed), expected value ...]

the line being run blobservice.getblobtotext, blobservice being connection azure (createblobservice...)

what's going on? :s

my code's below:

    // azure test     function downloadimageastext(blobservice, containername, blobname) {           blobservice.getblobtotext(               containername,               blobname,               function(err, blobcontent, blob) {                   if (err) {                       console.error("couldn't download blob %s", blobname);                       console.error(err);                   } else {                       console.log("sucessfully downloaded blob %s", blobname);                       console.log(blobcontent);                   }               });      }      function uploadimage(blobservice, containername, blobname, filename) {        blobservice.getblobproperties(         containername,         blobname,         function(err, properties, status) {             if (status.issuccessful) {                 // blob exists             } else {                 blobservice.createblockblobfromlocalfile(                     containername,                     blobname,                     filename,                     function(error, result, response){                         if(error){                             console.log("couldn't upload file %s", filename);                             console.error(error);                         } else {                             console.log('file %s uploaded successfully', filename);                             downloadimageastext(blobservice, containername, blobname);                         }                     });             }         });     }       function testazure() {        accountname / hash = details        var storage = require('azure-storage');       var blobservice = storage.createblobservice(accountname, hash);       var containername = 'tst';       var blobname = 'test.png';       var filename = 'test.png';        blobservice.createcontainerifnotexists(containername, function(err, result, response) {           if (err) {               console.log("couldn't create container %s", containername);               console.error(err);           } else {               if (result) {                   console.log('container %s created', containername);                   uploadimage(blobservice, containername, blobname, filename);               } else {                   console.log('container %s exists', containername);                   uploadimage(blobservice, containername, blobname, filename);               }           }       });     }      function startserver() {       http = require('http');       const port = 8080;       var server = http.createserver(handlerequest);       server.on('listening',function(){         console.log("server listening on: http://178.62.117.207:%s", port);       });       server.listen(port);     }      startserver();     testazure(); 

it can happen because of many internal md5 check failures works differently when use https. can please try specifying storage account https? -

var blobservice = storage.createblobserviceanonymous('https://myaccountxx.blob.core.windows.net/');

otherwise me, download function working fine.

for reference, can try following actual documentation - https://azure.microsoft.com/en-in/documentation/articles/storage-nodejs-how-to-use-blob-storage/


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -