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

index 84ecf556..aee9d345 100644 --- a/cdn/src/util/FileStorage.ts +++ b/src/cdn/util/FileStorage.ts
@@ -1,17 +1,16 @@ 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 = require("exif-be-gone"); +import ExifTransformer from "exif-be-gone"; // TODO: split stored files into separate folders named after cloned route function getPath(path: string) { // STORAGE_LOCATION has a default value in start.ts const root = process.env.STORAGE_LOCATION || "../"; - var filename = join(root, path); + let filename = join(root, path); if (path.indexOf("\0") !== -1 || !filename.startsWith(root)) throw new Error("invalid path"); @@ -36,7 +35,8 @@ export class FileStorage implements Storage { async set(path: string, value: any) { path = getPath(path); - fse.ensureDirSync(dirname(path)); + //fse.ensureDirSync(dirname(path)); + fs.mkdirSync(dirname(path), {recursive: true}); value = Readable.from(value); const cleaned_file = fs.createWriteStream(path);