Following the instructions from the documentation, I try to upload a file on a bucket.
If I upload a text file (i.e. a csv file), everything works as expected.
If I upload a binary string file (i.e. a pdf file) (read using readAsBinaryString), the file on cloud storage is wrong, only blank pages. The file size and the 256hash of the file changes.
I used all:
- A buffer
Buffer.from(binaryString)
- A Uint8Array
new TextEncoder().encode(binaryString)
- A the binary string
on
putObject({
Bucket: 'test-b',
Key: key,
Body: binaryString
})
Instead of using the binary stream of the file for PDF try to upload using the multipart file upload option to upload it.