Skip to content

Commit dca2ad5

Browse files
committed
Reuse S3 client
1 parent f40893b commit dca2ad5

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/server/utils/S3.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ import type { GetObjectCommandOutput } from '@aws-sdk/client-s3';
22
import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
33
import { credentials, region } from './aws';
44

5-
const getS3 = (): S3Client =>
6-
new S3Client({
7-
credentials: credentials(),
8-
region,
9-
});
5+
const s3Client = new S3Client({
6+
credentials: credentials(),
7+
region,
8+
});
109

1110
export const fetchS3Data = (bucket: string, key: string): Promise<string> => {
12-
const client = getS3();
13-
return client
11+
return s3Client
1412
.send(
1513
new GetObjectCommand({
1614
Bucket: bucket,

0 commit comments

Comments
 (0)