feat: implement direct file upload functionality with S3 integration

This commit is contained in:
암냥 2026-04-23 19:46:43 +09:00
commit b9a522c6d7
No known key found for this signature in database
3 changed files with 220 additions and 39 deletions

View file

@ -37,7 +37,7 @@ async function uploadToS3(fileName: string, mediaUrl: string, maxRetry = 3) {
}
const buffer = await response.arrayBuffer();
// 2. Bun S3 Client만 사용하여 쓰기
// client.write는 내부적으로 효율적인 스트리밍/버퍼 처리를 수행합니다.
await client.write(fileName, buffer, {
@ -67,4 +67,11 @@ async function uploadToS3(fileName: string, mediaUrl: string, maxRetry = 3) {
throw lastError;
}
export { makeS3FileName, uploadToS3, client as s3Client };
async function writeToS3(fileName: string, data: ArrayBuffer | Blob, contentType: string) {
await warmupS3();
await client.write(fileName, data, {
type: contentType,
});
}
export { makeS3FileName, uploadToS3, writeToS3, client as s3Client };