S3.getSignedUrl上传损坏的视频文件

时间:2020-03-03 14:13:19

标签: javascript node.js typescript amazon-web-services amazon-s3

我需要上传大于10 MB的视频文件,因此我通过s3.getSignedUrl发送到前端链接。我可以将视频文件上传到S3,但是它已损坏(我无法播放)。查看上载视频文件的元数据信息时,我看到Content-Type为 multipart / form-data; boundary = -------------------------- 552383848847187991927004

const s3: S3 = new S3({
  apiVersion: '2010-12-01',
  signatureVersion: 'v4',
  region: process.env.AWS_DEFAULT_REGION || 'eu-west-1',
});
const params = {
      Bucket: mediaBucket,
      Key: 'videos/' + Constants.SUBSUBFOLDER.original + '/' + name,
      Expires: 1000,
      ContentType: 'video/mp4',
    };
    const s3Values = s3.getSignedUrl('putObject', params);

时段政策

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AddPerm",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::media.devel.acme.xxx.com/*"
        },
        {
            "Sid": "AddPerm",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:putObject",
            "Resource": "arn:aws:s3:::media.devel.acme.xxx.com/*"
        }
    ]
}

0 个答案:

没有答案