feat: turn mimetype into proper util to dedupe this all
Node.js CI / CI (push) Successful in 25s
Security Scan and Upload / Security & DefectDojo Upload (push) Successful in 59s

This commit is contained in:
2026-01-08 23:29:50 -08:00
parent 6acef3b770
commit 6fe566b3f6
5 changed files with 93 additions and 149 deletions
+7 -3
View File
@@ -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);