mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 02:13:00 +00:00
4 TABS
This commit is contained in:
1 parent
1a62f1dd8e
commit
b874e999ab
1 file changed
+4
-4
@@ -17,14 +17,14 @@ export class FileStorage implements Storage {
|
||||
|
||||
async set(path: string, value: any) {
|
||||
path = join(process.env.STORAGE_LOCATION || "", path).replace(/[\\]/g, "/");
|
||||
const dir = path.split("/").slice(0, -1).join("/");
|
||||
await fs.mkdir(dir, { recursive: true }).caught();
|
||||
const dir = path.split("/").slice(0, -1).join("/");
|
||||
await fs.mkdir(dir, { recursive: true }).caught();
|
||||
|
||||
return fs.writeFile(path, value, { encoding: "binary" });
|
||||
return fs.writeFile(path, value, { encoding: "binary" });
|
||||
}
|
||||
|
||||
async delete(path: string) {
|
||||
path = join(process.env.STORAGE_LOCATION || "", path);
|
||||
await fs.unlink(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user