aws js sdk error

I am trying to download a file from my buckect using js sdk. How to I convert the response body which is of type 'GetObjectCommandOutput' to a pdf? Currently I am doing the following:
try {
const response = await client.send(command);
const blob = new Blob([await response.Body?.arrayBuffer()], { type: response.ContentType });

const downloadLink = document.createElement("a");
downloadLink.href = URL.createObjectURL(blob);
} catch (err) {
console.error(err);
}
try {
const response = await client.send(command);
const blob = new Blob([await response.Body?.arrayBuffer()], { type: response.ContentType });

const downloadLink = document.createElement("a");
downloadLink.href = URL.createObjectURL(blob);
} catch (err) {
console.error(err);
}
but i get this error: Property 'arrayBuffer' does not exist on type 'StreamingBlobPayloadOutputTypes'. Property 'arrayBuffer' does not exist on type 'Readable & SdkStreamMixin'.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server