我正在使用 Cognito 从 javascript 将文件上传到 AWS S3,并观察到上传大于 1MB 的文件需要很长时间。 (例如:上传 100MB 文件约 5 分钟)。 这是代码片段。
import * as AWS from "aws-sdk";
s3: any;
private awsConfig() {
const AWSService = AWS;
AWSService.config.update({
region: "ap-south-1",
credentials: new AWSService.CognitoIdentityCredentials({
IdentityPoolId: "ap-south-1:<IdentityPoolId>",
}),
});
this.s3 = new AWSService.S3({
apiVersion: "2006-03-01",
params: { Bucket: "bucketName" },
});
}
this.s3.upload(
{
Key: file.name,
Bucket: "bucketName",
Body: file,
ACL: "private",
},
(err, data) => {
console.log(err);
console.log(data);
});
调用上传后,需要很长时间才能返回响应。 请提出建议。