Update aws-compatible put signatures

This commit is contained in:
Sam Becker 2024-06-07 10:26:44 -05:00
parent fb452f2473
commit ed0d485dfe
2 changed files with 4 additions and 4 deletions

View File

@ -32,14 +32,14 @@ export const isUrlFromAwsS3 = (url?: string) =>
export const awsS3PutObjectCommandForKey = (Key: string) =>
new PutObjectCommand({ Bucket: AWS_S3_BUCKET, Key, ACL: 'public-read' });
export const awsS3Put = (
export const awsS3Put = async (
file: Blob,
fileName: string,
): Promise<string> =>
awsS3Client().send(new PutObjectCommand({
Bucket: AWS_S3_BUCKET,
Key: fileName,
Body: new File([file], fileName),
Body: Buffer.from(await file.arrayBuffer()),
ACL: 'public-read',
}))
.then(() => urlForKey(fileName));

View File

@ -53,14 +53,14 @@ export const isUrlFromCloudflareR2 = (url?: string) => (
export const cloudflareR2PutObjectCommandForKey = (Key: string) =>
new PutObjectCommand({ Bucket: CLOUDFLARE_R2_BUCKET, Key });
export const cloudflareR2Put = (
export const cloudflareR2Put = async (
file: Blob,
fileName: string,
): Promise<string> =>
cloudflareR2Client().send(new PutObjectCommand({
Bucket: CLOUDFLARE_R2_BUCKET,
Key: fileName,
Body: new File([file], fileName),
Body: Buffer.from(await file.arrayBuffer()),
}))
.then(() => urlForKey(fileName));