const COS = require('cos-nodejs-sdk-v5');
const config = {
SecretId: 'xxx',
SecretKey: 'xxx',
};
const cos = new COS(config);
cos.putObject({
Bucket: 'xxx',
Region: 'xxx',
key: '/private3.0/dist.zip',
FilePath: './dist.zip',
onProgress(progressData) {
console.log(JSON.stringify(progressData));
},
onFileFinish(err, data, options) {
console.log(`${options.Key}上传${err ? '失败' : '完成'}`);
},
}, (err, data) => {
console.log(err || data);
});
执行报错: { code: 'Error', name: 'Error', message: 'missing param Key' }