25 lines
440 B
JavaScript
25 lines
440 B
JavaScript
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
|
|
|
|
export function createClient(region, maxAttempts) {
|
|
return new S3Client({ region, maxAttempts });
|
|
}
|
|
|
|
export async function upload({
|
|
client,
|
|
Bucket,
|
|
Key,
|
|
Body,
|
|
ContentMD5,
|
|
ContentType,
|
|
...rest
|
|
}) {
|
|
const command = new PutObjectCommand({
|
|
Bucket,
|
|
Key,
|
|
Body,
|
|
ContentMD5,
|
|
ContentType,
|
|
...rest
|
|
});
|
|
return await client.send(command);
|
|
} |