I'm uploading recursively content folder for my site on blob storage. Overall routine is quite simple:
1 - Drop container if exists ( runs good)
2 - Create container (runs ok, yet must tell that it's an iterative process that takes few attempts)
3 - Run through the folder recursively and upload files as blob to the storage ( partially ok)
Third step runs blazing fast, but doesn't rise neither internal error nor calls my callback
Here is a code for the blob upload
upload: function( container, blobname, file ){
var p = new Promise();
this.service.createBlockBlobFromLocalFile( container, blobname, file, function( error ){
if( error ){
throw error;
}
console.log( "Uploaded file '"+ file +"' to container in '" + blobname + "'" );
p.resolve();
} );
return p;
}
I must mention that none of other methods like createBlockBlobFromStream and others did work as well. I'm definitely doing it wrong, but I can't see what.
Finally found my mistake and It's where you're right Emily. Games with promises didn't went well.
I forgot to return promise from folders process method and thus finished the overall task long before azure response.
blobsService.cleanContainer( container ).
then( blobsService.createContainer.bind( blobsService ) ).
then( function(){
var folders = data.rootFolder.split( path.sep );
!!!return!!! blobsService.processFolder( container, data.rootFolder, folders[ folders.length - 1 ] );
}).
then( resolver );