【问题标题】:Amazon retries upload with large files亚马逊重试上传大文件
【发布时间】: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


    【解决方案1】:

    对于大型对象,您可以尝试upload功能,支持进度跟踪和分段上传以并行上传部分。此外,我没有在您的示例中看到内容长度设置,实际上 uplaod 接受没有必要定义内容长度的流。

    一个例子:https://aws.amazon.com/blogs/developer/announcing-the-amazon-s3-managed-uploader-in-the-aws-sdk-for-javascript/

    【讨论】:

      【解决方案2】:

      您需要使用multipart 上传大文件。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-12-04
        • 1970-01-01
        • 1970-01-01
        • 2021-02-23
        • 2017-07-11
        相关资源
        最近更新 更多