el.xwx.moe/lib/api/storage/createFolder.ts

15 lines
433 B
TypeScript
Raw Normal View History

import fs from "fs";
import path from "path";
import s3Client from "./s3Client";
export default function createFolder({ filePath }: { filePath: string }) {
if (s3Client) {
2023-07-18 10:59:57 -05:00
// Do nothing, S3 creates directories recursively
} else {
const storagePath = process.env.STORAGE_FOLDER;
const creationPath = path.join(process.cwd(), storagePath + "/" + filePath);
fs.mkdirSync(creationPath, { recursive: true });
}
}