split uploaded and generated backups

This commit is contained in:
Julian Krauser 2025-02-03 11:03:31 +01:00
parent 542a77fbef
commit 0d6103170a
6 changed files with 122 additions and 15 deletions

View file

@ -11,14 +11,17 @@ export abstract class FileSystemHelper {
}
static readFile(...filePath: string[]) {
this.createFolder(...filePath);
return readFileSync(this.formatPath(...filePath), "utf8");
}
static readFileasBase64(...filePath: string[]) {
this.createFolder(...filePath);
return readFileSync(this.formatPath(...filePath), "base64");
}
static readTemplateFile(filePath: string) {
this.createFolder(filePath);
return readFileSync(process.cwd() + filePath, "utf8");
}
@ -28,6 +31,13 @@ export abstract class FileSystemHelper {
writeFileSync(path, file);
}
static deleteFile(...filePath: string[]) {
const path = this.formatPath(...filePath);
if (existsSync(path)) {
unlinkSync(path);
}
}
static formatPath(...args: string[]) {
return join(process.cwd(), "files", ...args);
}