1
+ // @ts -check
1
2
var config = {
2
3
Bucket : 'test-1250000000' ,
3
4
Region : 'ap-guangzhou'
@@ -891,7 +892,6 @@ function getObject() {
891
892
cos . getObject ( {
892
893
Bucket : config . Bucket , // Bucket 格式:test-1250000000
893
894
Region : config . Region ,
894
- Key : '1mb.zip' ,
895
895
onProgress : function ( progressData ) {
896
896
console . log ( JSON . stringify ( progressData ) ) ;
897
897
}
@@ -1174,8 +1174,8 @@ function uploadFiles() {
1174
1174
} ] ,
1175
1175
SliceSize : 1024 * 1024 ,
1176
1176
onProgress : function ( info ) {
1177
- var percent = parseInt ( info . percent * 10000 ) / 100 ;
1178
- var speed = parseInt ( info . speed / 1024 / 1024 * 100 ) / 100 ;
1177
+ var percent = Math . floor ( info . percent * 10000 ) / 100 ;
1178
+ var speed = Math . floor ( info . speed / 1024 / 1024 * 100 ) / 100 ;
1179
1179
logger . log ( '进度:' + percent + '%; 速度:' + speed + 'Mb/s;' ) ;
1180
1180
} ,
1181
1181
onFileFinish : function ( err , data , options ) {
@@ -1200,8 +1200,8 @@ function sliceCopyFile() {
1200
1200
CopySource : sourcePath ,
1201
1201
SliceSize : 2 * 1024 * 1024 , // 大于2M的文件用分片复制,小于则用单片复制
1202
1202
onProgress :function ( info ) {
1203
- var percent = parseInt ( info . percent * 10000 ) / 100 ;
1204
- var speed = parseInt ( info . speed / 1024 / 1024 * 100 ) / 100 ;
1203
+ var percent = Math . floor ( info . percent * 10000 ) / 100 ;
1204
+ var speed = Math . floor ( info . speed / 1024 / 1024 * 100 ) / 100 ;
1205
1205
logger . log ( '进度:' + percent + '%; 速度:' + speed + 'Mb/s;' ) ;
1206
1206
}
1207
1207
} , function ( err , data ) {
@@ -1236,8 +1236,8 @@ function uploadFolder() {
1236
1236
files : files ,
1237
1237
SliceSize : 1024 * 1024 ,
1238
1238
onProgress : function ( info ) {
1239
- var percent = parseInt ( info . percent * 10000 ) / 100 ;
1240
- var speed = parseInt ( info . speed / 1024 / 1024 * 100 ) / 100 ;
1239
+ var percent = Math . floor ( info . percent * 10000 ) / 100 ;
1240
+ var speed = Math . floor ( info . speed / 1024 / 1024 * 100 ) / 100 ;
1241
1241
logger . log ( '进度:' + percent + '%; 速度:' + speed + 'Mb/s;' ) ;
1242
1242
} ,
1243
1243
onFileFinish : function ( err , data , options ) {
@@ -1332,8 +1332,7 @@ function deleteFolder() {
1332
1332
} ;
1333
1333
next ( ) ;
1334
1334
} ;
1335
- _delet
1336
- eFolder ( {
1335
+ _deleteFolder ( {
1337
1336
Bucket : config . Bucket ,
1338
1337
Region : config . Region ,
1339
1338
Prefix : 'folder/' , // 要列出的目录前缀
0 commit comments