summary refs log tree commit diff
path: root/src/cdn/util
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/cdn/util/FileStorage.ts (renamed from cdn/src/util/FileStorage.ts)5
-rw-r--r--src/cdn/util/S3Storage.ts (renamed from cdn/src/util/S3Storage.ts)0
-rw-r--r--src/cdn/util/Storage.ts (renamed from cdn/src/util/Storage.ts)4
-rw-r--r--src/cdn/util/index.ts (renamed from cdn/src/util/index.ts)0
-rw-r--r--src/cdn/util/multer.ts (renamed from cdn/src/util/multer.ts)0
5 files changed, 4 insertions, 5 deletions
diff --git a/cdn/src/util/FileStorage.ts b/src/cdn/util/FileStorage.ts

index 84ecf556..955c570b 100644 --- a/cdn/src/util/FileStorage.ts +++ b/src/cdn/util/FileStorage.ts
@@ -1,10 +1,9 @@ import { Storage } from "./Storage"; import fs from "fs"; -import fse from "fs-extra"; import { join, relative, dirname } from "path"; import "missing-native-js-functions"; import { Readable } from "stream"; -import ExifTransformer = require("exif-be-gone"); +import ExifTransformer from "exif-be-gone"; // TODO: split stored files into separate folders named after cloned route @@ -36,7 +35,7 @@ export class FileStorage implements Storage { async set(path: string, value: any) { path = getPath(path); - fse.ensureDirSync(dirname(path)); + if (!fs.existsSync(dirname(path))) fs.mkdirSync(dirname(path)); value = Readable.from(value); const cleaned_file = fs.createWriteStream(path); diff --git a/cdn/src/util/S3Storage.ts b/src/cdn/util/S3Storage.ts
index c4066817..c4066817 100644 --- a/cdn/src/util/S3Storage.ts +++ b/src/cdn/util/S3Storage.ts
diff --git a/cdn/src/util/Storage.ts b/src/cdn/util/Storage.ts
index 89dd5634..04fbacca 100644 --- a/cdn/src/util/Storage.ts +++ b/src/cdn/util/Storage.ts
@@ -1,6 +1,6 @@ import { FileStorage } from "./FileStorage"; import path from "path"; -import fse from "fs-extra"; +import fs from "fs"; import { bgCyan, black } from "picocolors"; import { S3 } from "@aws-sdk/client-s3"; import { S3Storage } from "./S3Storage"; @@ -22,7 +22,7 @@ if (process.env.STORAGE_PROVIDER === "file" || !process.env.STORAGE_PROVIDER) { location = path.join(process.cwd(), "files"); } console.log(`[CDN] storage location: ${bgCyan(`${black(location)}`)}`); - fse.ensureDirSync(location); + if (!fs.existsSync(location)) fs.mkdirSync(location); process.env.STORAGE_LOCATION = location; storage = new FileStorage(); diff --git a/cdn/src/util/index.ts b/src/cdn/util/index.ts
index 07a5c31a..07a5c31a 100644 --- a/cdn/src/util/index.ts +++ b/src/cdn/util/index.ts
diff --git a/cdn/src/util/multer.ts b/src/cdn/util/multer.ts
index bfdf6aff..bfdf6aff 100644 --- a/cdn/src/util/multer.ts +++ b/src/cdn/util/multer.ts