AWS-SDK客户端S3上传:8 GB上传后Chrome崩溃
我想从浏览器上传 17 GB 文件,但在 8 GB chrome 因内存耗尽而崩溃后
import { PutObjectCommandInput, S3Client } from '@aws-sdk/client-s3';
import { Progress, Upload } from "@aws-sdk/lib-storage";
const uploadParams: PutObjectCommandInput = {
Bucket: 'my-bucket',
Key: 'my-file',
Body: file, // is File from <input type="file">
};
const upload: Upload = new Upload({
client: s3Client,
params: uploadParams,
});
// start upload
await upload.done();
我做错了什么?
I want upload from browser a 17 GB file, but after 8 GB chrome crash for memory exhaustion
import { PutObjectCommandInput, S3Client } from '@aws-sdk/client-s3';
import { Progress, Upload } from "@aws-sdk/lib-storage";
const uploadParams: PutObjectCommandInput = {
Bucket: 'my-bucket',
Key: 'my-file',
Body: file, // is File from <input type="file">
};
const upload: Upload = new Upload({
client: s3Client,
params: uploadParams,
});
// start upload
await upload.done();
what I'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AWS S3具有a 5GB尺寸限制放置操作。
您需要启动a 多方part上载上传之前,将其归档到块中(例如5GB) - 此 May 还可以解决您的Chrome崩溃。
即使Chrome没有崩溃,您的代码也无法正常工作 - 将文件放置并一个接一个地上传。
AWS S3 has a 5GB size limit on a single PUT operation.
You need to initiate a multi-part upload and split the file into chunks (5GB for example) before uploading - this may also resolve your Chrome crashing.
Even if Chrome did not crash, your code wouldn't work as it is - chunk up the file and upload them one by one.