.toBuffer() not working with s3.putObject
See original GitHub issueWhen I try to write my generated .docx file to s3, everything goes well. But when I download the file from s3 using the public link, my text editor can’t open it as it is base64 encoded string. If I use packer.toBuffer(doc)
instead the s3.putObject
is not happy and says he requires buffer or base64 string. Why is toBuffer
not valid argument for s3.putObject.
...
// set up doc and packer, doc is generated normally I checked
const documentBuffer = await packer.toBase64String(doc);
s3.putObject(
{
Bucket: "my-bucket",
Key: "my-file.docx",
Body: documentBuffer,
ACL: "public-read",
ContentEncoding: "base64",
ContentType:
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
},
resp => {
console.log({ resp });
}
);
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
PUT base64 encoded buffer to AWS S3 bucket with ...
I'm fairly certain this is due to a lack of response from AWS due to an incorrectly formatted buffer. I've run into similar...
Read more >Using an Amazon S3 trigger to create thumbnail images
Amazon S3 invokes the CreateThumbnail function for each image file that is uploaded to an ... Follow these steps to create S3 buckets...
Read more >Upload paper.js as PNG to Amazon AWS/S3
It looks like my generated paper projects have a different alignment when I write them toBuffer() compared to when I export them as...
Read more >Amazon S3 - Fluent Bit: Official Manual
The plugin can upload data to S3 using the multipart upload API or using S3 ... help improve throughput when there are transient/random...
Read more >Storing Images in S3 from Node Server
toBuffer() // Configure the upload details to send to S3 const fileName ... I just also want to bring to your notice that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same issue (https://github.com/dolanmiu/docx/issues/379).
You can wrap the “buffer” and it will work:
@dolanmiu Why was this issue closed? It isn’t resolved.