(file: {
filename: string;
contentType: string;
stream: PutObjectCommandInput['Body'];
})
| 38 | } |
| 39 | |
| 40 | export async function uploadFile(file: { |
| 41 | filename: string; |
| 42 | contentType: string; |
| 43 | stream: PutObjectCommandInput['Body']; |
| 44 | }) { |
| 45 | if (sharedEnvs.NODE_ENV === 'test') return null; |
| 46 | return new Upload({ |
| 47 | client: s3bucket, |
| 48 | |
| 49 | params: { |
| 50 | Bucket: sharedEnvs.BUCKET_NAME as string, |
| 51 | Key: `${file.filename}`, |
| 52 | Body: file.stream, |
| 53 | ContentDisposition: 'inline', |
| 54 | ContentType: file.contentType, |
| 55 | }, |
| 56 | }).done(); |
| 57 | } |