Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	dist/cos-js-sdk-v5.js
#	dist/cos-js-sdk-v5.min.js
#	package.json
#	webpack.config.js
  • Loading branch information
carsonxu committed Nov 1, 2017
2 parents e451781 + 525ccae commit a8a454f
Show file tree
Hide file tree
Showing 15 changed files with 8,125 additions and 22,677 deletions.
38 changes: 37 additions & 1 deletion demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ function deleteBucket() {

function putObject() {
// 创建测试文件
var blob = util.createFile({size: 1024 * 1024 * 10});
var filename = '1mb.zip';
var blob = util.createFile({size: 10});
// 调用方法
cos.putObject({
Bucket: config.Bucket, /* 必须 */
Expand Down Expand Up @@ -538,6 +538,40 @@ function restartTask() {
console.log('restart');
}

function uploadFiles() {
var filename = 'mb.zip';
var blob = util.createFile({size: 1024 * 1024 * 10});
cos.uploadFiles({
files: [{
Bucket: config.Bucket,
Region: config.Region,
Key: '1' + filename,
Body: blob,
}, {
Bucket: config.Bucket,
Region: config.Region,
Key: '2' + filename,
Body: blob,
}, {
Bucket: config.Bucket,
Region: config.Region,
Key: '3' + filename,
Body: blob,
}],
SliceSize: 1024 * 1024,
onProgress: function (info) {
var percent = parseInt(info.percent * 10000) / 100;
var speed = parseInt(info.speed / 1024 / 1024 * 100) / 100;
console.log('进度:' + percent + '%; 速度:' + speed + 'Mb/s;');
},
onFileFinish: function (err, data, options) {
console.log(options.Key + ' 上传' + (err ? '失败' : '完成'));
},
}, function (err, data) {
console.log(err || data);
});
}

// getAuth();
// getBucket();
// headBucket();
Expand Down Expand Up @@ -569,6 +603,7 @@ function restartTask() {
// cancelTask();
// pauseTask();
// restartTask();
// uploadFiles();


(function () {
Expand Down Expand Up @@ -607,6 +642,7 @@ function restartTask() {
'cancelTask',
'pauseTask',
'restartTask',
'uploadFiles',
];
var container = document.querySelector('.main');
var html = [];
Expand Down
Loading

0 comments on commit a8a454f

Please sign in to comment.