Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 22 lines 786 B view raw
1import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3'; 2 3function s3StoreObjectFactory(region: string, bucketName: string) { 4 const client = new S3Client({ region }); 5 6 return async function (objectKey: string, content: Uint8Array) { 7 // No return value for now, since we don't want to expand the contract too 8 // much/prematurely. callers just need to know if it succeeded or not, which 9 // they can get from whether the promise resolves or rejects. 10 await client.send( 11 new PutObjectCommand({ 12 Bucket: bucketName, 13 Key: objectKey, 14 Body: content, 15 }), 16 ); 17 }; 18} 19 20export default s3StoreObjectFactory; 21export type S3StoreObjectFactory = typeof s3StoreObjectFactory; 22export type S3StoreObject = ReturnType<S3StoreObjectFactory>;