split uploaded and generated backups
This commit is contained in:
parent
542a77fbef
commit
0d6103170a
6 changed files with 122 additions and 15 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue