maneesh
maneesh
CDCloudflare Developers
Created by maneesh on 11/26/2023 in #pages-help
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'.
1 replies
CDCloudflare Developers
Created by maneesh on 11/24/2023 in #pages-help
Invalid region
I am trying to connect to cloudfare r2 bucket using s3 go sdk. But I am getting the following error: operation error S3: ListBuckets, resolve auth scheme: resolve endpoint: endpoint rule error, Invalid region: region was not a valid DNS name. Can someone please provide a solution 🙂
6 replies