Using a third-party API I receive a PNG attachement back from my request with:
Headers:
Content-Type: "image/png" Content-Disposition: attachment; filename*=UTF-8''Api-URL-2021-05-13T09-21-31-094_clipped_rev_1.png
And
data
data: `�PNGrn...IHDR ........`
I can see the image displayed in postman and looks ok.
The issue is I want to save that image to an
S3 bucket
S3
Can I convert this
data
Here is my S3 function:
function saveFile(data: Buffer | Uint8Array | Blob | string | Readable) { const putParams = { Bucket: 'my-bucket', Key: 'test-file', Body: data, }; s3.putObject(putParams, (putErr, putData) => { if (putErr) { console.error(putErr); } else { console.log(putData); } }); }
And
Body
Buffer | Uint8Array | Blob | string | Readable
TypeScript
Anonymous Asked question May 13, 2021
Recent Comments