AWS-SDK客户端S3上传:8 GB上传后Chrome崩溃

发布于 2025-01-19 14:57:20 字数 486 浏览 1 评论 0原文

我想从浏览器上传 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爺獨霸怡葒院 2025-01-26 14:57:20

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文