'upload zip file to s3 but not unzip it (corrupt)
The file was successfully uploaded on the s3 bucket but when I download the zip file and does unzip it the file corrupt not unzip.
how i solve it
//this is my code
const { S3 } = require("aws-sdk");
const s3Uploadv2 = async (file) => {
const s3 = new S3();
const param = {
Bucket: "bb-vision/production-script",
Key: `${file.originalname}`,
Body: file.buffer,
ACL: "public-read",
ContentType: file.mimetype,
ContentEncoding: file.encoding,
};
return await s3.upload(param).promise();
};
module.exports = s3Uploadv2;
app.post("/devices/production", upload.array("file_script"), async (req, res) => {
const file= req.files[0];`enter code here`
const result = await s3Uploadv2(file);
return res.status(201).send(result)`enter code here`
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
