Skip to content

Commit

Permalink
use byteCount instread of _readable State #2
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasredev committed Mar 25, 2015
1 parent fa14d16 commit 1a41755
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,14 @@ module.exports = function SkipperAzure( globalOptions ) {
contentType: headers['content-type']
};

// TODO: only used for the waterline-adapter-tests, because they do not set the byteCount attribute
// checkout the issue on: https://github.com/lukasreichart/skipper-azure/pull/2
if( !newFile.byteCount ){
newFile.byteCount = newFile._readableState.length;
}

var uploader = blobService.createBlockBlobFromStream( options.container,
newFile.fd, newFile, newFile._readableState.length, uploadOptions, function( err, result, response ) {
newFile.fd, newFile, newFile.byteCount, uploadOptions, function( err, result, response ) {
if( err ) {
console.log( ('Receiver: Error writing ' + newFile.filename + ' :: Cancelling upload and cleaning up already-written bytes ... ' ).red );
receiver.emit( 'error', err );
Expand Down

0 comments on commit 1a41755

Please sign in to comment.