我正在使用aws-amplify
sdk通过angular将文件上传到S3,我想看看有多少文件已上传到存储桶。
Storage.put(id, name)
.then (result => console.log(result))
.catch(err => console.log(err)).on('httpUploadProgress', function(progress) {
// Here you can use `this.body` to determine which file this particular
// event is related to and use that info to calculate overall progress.
});
这不起作用,我似乎无法找到解决方案。
答案 0 :(得分:1)
可以获取Storage API的上传进度(aws-amplify)。 但仍未在官方doc中进行记录。
尝试
Storage.put(id, name, {
progressCallback(progress) {
console.log(`Uploaded percentage: ${progress.loaded}/${progress.total}`);
},
});
答案 1 :(得分:1)
Amplify文档现在包括此内容-https://aws-amplify.github.io/docs/js/storage#put