mirror of
https://github.com/linkwarden/linkwarden.git
synced 2026-06-30 07:46:13 +00:00
20 lines
467 B
TypeScript
20 lines
467 B
TypeScript
import fs from "fs";
|
|
import path from "path";
|
|
import s3Client from "./s3Client";
|
|
|
|
export function createFolder({ filePath }: { filePath: string }) {
|
|
if (s3Client) {
|
|
// Do nothing, S3 creates directories recursively
|
|
} else {
|
|
const storagePath = process.env.STORAGE_FOLDER || "data";
|
|
const creationPath = path.join(
|
|
process.cwd(),
|
|
"../..",
|
|
storagePath,
|
|
filePath
|
|
);
|
|
|
|
fs.mkdirSync(creationPath, { recursive: true });
|
|
}
|
|
}
|