const imageArrayBuffer = await fetch(
imageUrl,
{
method: "GET",
redirect: "follow",
},
);
const temp = await imageArrayBuffer.arrayBuffer();
// Cache the image in our CDN
const r2Object = await this.bucket.put(
`images/${imageRef}`,
temp,
);
if (!r2Object) {
throw new Error("Failed to cache image in R2");
}
const imageArrayBuffer = await fetch(
imageUrl,
{
method: "GET",
redirect: "follow",
},
);
const temp = await imageArrayBuffer.arrayBuffer();
// Cache the image in our CDN
const r2Object = await this.bucket.put(
`images/${imageRef}`,
temp,
);
if (!r2Object) {
throw new Error("Failed to cache image in R2");
}