I am trying to upload base64 file at s3 but unable to open from s3 but if i click on download and then open the same file then it works fine able to open without any issue
Here is my code:
const fileStream = Buffer.from(Attachments[i].bytes, 'base64'),
const s3 = new AWS.S3();
const contentType = mime.contentType(path.extname(fileName));
const params = {
Bucket: bucket,
Key: s3Key,
ContentEncoding: 'base64',
Body: fileStream,
} as PutObjectRequest;
if (contentType !== false) {
params.ContentType = contentType;
}
const putPromise = s3.upload(params).promise();
const [err, response] = await to(putPromise);
Did i miss something
copy file link and paste in your browser this will open your file in browser
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.