generated from nhcarrigan/template
feat: turn mimetype into proper util to dedupe this all
This commit is contained in:
@@ -8,6 +8,7 @@ import { join, relative } from "node:path";
|
||||
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
|
||||
import { confirm } from "@inquirer/prompts";
|
||||
import { SingleBar, Presets } from "cli-progress";
|
||||
import { getMimeType } from "../utils/mimeType.js";
|
||||
|
||||
const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
|
||||
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
|
||||
@@ -185,14 +186,17 @@ for (const file of files) {
|
||||
try {
|
||||
const filePath = join(dataDirectory, file);
|
||||
const fileContent = await readFile(filePath);
|
||||
const contentType = getMimeType(file);
|
||||
|
||||
const command = new PutObjectCommand({
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- AWS SDK
|
||||
Body: fileContent,
|
||||
Body: fileContent,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- AWS SDK
|
||||
Bucket: "nhcarrigan",
|
||||
Bucket: "nhcarrigan",
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- AWS SDK
|
||||
Key: file,
|
||||
ContentType: contentType,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- AWS SDK
|
||||
Key: file,
|
||||
});
|
||||
|
||||
await s3.send(command);
|
||||
|
||||
Reference in New Issue
Block a user