Reputation: 4887
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?
Upvotes: 0
Views: 625
Reputation: 23582
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.
Upvotes: 1