【发布时间】:2021-03-02 07:39:54
【问题描述】:
我遇到了麻烦,我在浏览器上使用 aws-sdk 将视频从我的网络应用程序上传到 Amazon S3,它适用于最短文件(小于 100MB)但适用于大文件(例如 500MB)亚马逊重试上传。
例如,上传28%的时候又回到1%,不知道为什么,我放了一个上传文件的事件监听器,但是没有报错,只是回到1 %
实际上这是我的代码:
const params = {
Bucket: process.env.VUE_APP_AWS_BUCKET_NAME, // It comes from my dotenv file
Key: videoPath, // It comes from a external var
ACL: 'public-read',
ContentType: this.type, // It comes from my class where i have the video type
Body: VideoObject // <- It comes from the input file
};
s3.putObject(params, function (err) {
if (err)
console.log(err);
}).on('httpUploadProgress', progress => {
console.log(progress);
console.log(progress.loaded + " - " + progress.total);
this.progress = parseInt((progress.loaded * 100) / progress.total);
});
我真的很想提供更多信息,但这就是我所拥有的,我不知道为什么 s3 重试上传而没有任何错误(我也不知道如何捕获 s3 错误...)
我的互联网连接很好,我正在使用我的业务连接,它工作正常,这个问题发生在我所有的电脑上
【问题讨论】:
标签: amazon-web-services amazon-s3 file-upload aws-sdk aws-sdk-js