File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -299,13 +299,11 @@ this.setConfig = function (config) {
299
299
libPath : config . libPath ,
300
300
maxBlockSize : maxBlockSize , //Each file will be split in 256 KB.
301
301
numberOfBlocks : numberOfBlocks ,
302
- totalBytesRemaining : fileSize ,
303
302
fileSize : fileSize ,
304
303
currentFilePointer : 0 ,
305
304
blocks : [ ] ,
306
305
blockIdPrefix : 'block-' ,
307
306
blocksReadIndex : 0 ,
308
- bytesUploaded : 0 ,
309
307
file : file ,
310
308
blobUri : config . blobUri ,
311
309
error : config . error ,
@@ -360,10 +358,15 @@ this.upload = function () {
360
358
} ;
361
359
362
360
var removeProcessedAction = function ( block , action , result ) {
363
- state . bytesUploaded += block . size ;
364
- state . totalBytesRemaining -= block . size ;
361
+ var totalBytesUploaded = state . blocks . filter ( function ( s ) {
362
+ return s . resolved ;
363
+ } ) . map ( function ( s ) {
364
+ return s . size ;
365
+ } ) . reduce ( function ( a , b ) {
366
+ return a + b ;
367
+ } ) ;
365
368
366
- var percentComplete = ( ( parseFloat ( block . size ) / parseFloat ( state . file . size ) ) * 100 ) . toFixed ( 2 ) ;
369
+ var percentComplete = ( ( parseFloat ( totalBytesUploaded ) / parseFloat ( state . file . size ) ) * 100 ) . toFixed ( 2 ) ;
367
370
368
371
progress ( {
369
372
result : result ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " angular-azure-blob" ,
3
- "version" : " 0.0.11 " ,
3
+ "version" : " 0.0.12 " ,
4
4
"dependencies" : {
5
5
"angular" : " latest" ,
6
6
"underscore" : " latest" ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " angular-azure-blob" ,
3
- "version" : " 0.0.11 " ,
3
+ "version" : " 0.0.12 " ,
4
4
"description" : " Angular Azure blob upload helper" ,
5
5
"scripts" : {
6
6
"test" : " echo \" Error: no test specified\" && exit 1"
You can’t perform that action at this time.
0 commit comments