2023-07-01 09:11:39 -05:00
|
|
|
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
|
2023-07-01 09:11:39 -05:00
|
|
|
} else {
|
2023-07-21 09:17:26 -05:00
|
|
|
const storagePath = process.env.STORAGE_FOLDER || "data";
|
2023-07-01 09:11:39 -05:00
|
|
|
const creationPath = path.join(process.cwd(), storagePath + "/" + filePath);
|
|
|
|
|
|
|
|
fs.mkdirSync(creationPath, { recursive: true });
|
|
|
|
}
|
|
|
|
}
|