Skip to content

Commit 1fe6e95

Browse files
committed
增加 index.d.ts 声明文件
1 parent 2e7475c commit 1fe6e95

File tree

3 files changed

+2106
-10
lines changed

3 files changed

+2106
-10
lines changed

demo/demo.js

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-check
12
var config = {
23
Bucket: 'test-1250000000',
34
Region: 'ap-guangzhou'
@@ -891,7 +892,6 @@ function getObject() {
891892
cos.getObject({
892893
Bucket: config.Bucket, // Bucket 格式:test-1250000000
893894
Region: config.Region,
894-
Key: '1mb.zip',
895895
onProgress: function (progressData) {
896896
console.log(JSON.stringify(progressData));
897897
}
@@ -1174,8 +1174,8 @@ function uploadFiles() {
11741174
}],
11751175
SliceSize: 1024 * 1024,
11761176
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;
11791179
logger.log('进度:' + percent + '%; 速度:' + speed + 'Mb/s;');
11801180
},
11811181
onFileFinish: function (err, data, options) {
@@ -1200,8 +1200,8 @@ function sliceCopyFile() {
12001200
CopySource: sourcePath,
12011201
SliceSize: 2 * 1024 * 1024, // 大于2M的文件用分片复制,小于则用单片复制
12021202
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;
12051205
logger.log('进度:' + percent + '%; 速度:' + speed + 'Mb/s;');
12061206
}
12071207
},function (err,data) {
@@ -1236,8 +1236,8 @@ function uploadFolder() {
12361236
files: files,
12371237
SliceSize: 1024 * 1024,
12381238
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;
12411241
logger.log('进度:' + percent + '%; 速度:' + speed + 'Mb/s;');
12421242
},
12431243
onFileFinish: function (err, data, options) {
@@ -1332,8 +1332,7 @@ function deleteFolder() {
13321332
};
13331333
next();
13341334
};
1335-
_delet
1336-
eFolder({
1335+
_deleteFolder({
13371336
Bucket: config.Bucket,
13381337
Region: config.Region,
13391338
Prefix: 'folder/', // 要列出的目录前缀

0 commit comments

Comments
 (0)