summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorxnacly <matteogropp@protonmail.com>2021-08-10 16:51:45 +0200
committerxnacly <matteogropp@protonmail.com>2021-08-10 16:51:45 +0200
commite8052ce7fc8c37cd8b34cfeb3cd3aeea1f292afe (patch)
tree6b02eadf0e4568acb144a6a2e2273894cc646450 /src
parent:sparkles: ping route (diff)
downloadserver-e8052ce7fc8c37cd8b34cfeb3cd3aeea1f292afe.tar.xz
added removal of metadata
includes all posted assets
Diffstat (limited to 'src')
-rw-r--r--src/util/FileStorage.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/FileStorage.ts b/src/util/FileStorage.ts

index 453133f3..6e74788f 100644 --- a/src/util/FileStorage.ts +++ b/src/util/FileStorage.ts
@@ -3,6 +3,8 @@ 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"); function getPath(path: string) { // STORAGE_LOCATION has a default value in start.ts @@ -26,7 +28,10 @@ export class FileStorage implements Storage { path = getPath(path); fse.ensureDirSync(dirname(path)); - return fs.writeFileSync(path, value, { encoding: "binary" }); + value = Readable.from(value); + const cleaned_file = fs.createWriteStream(path); + + return value.pipe(new ExifTransformer()).pipe(cleaned_file); } async delete(path: string) {