commit c6c18360c4e17e5e75690bf576d4d33d8710ff02
parent 609e816170169aa2c6c10e6704b7b5fa3fbdd33d
Author: MTRNord <mtrnord1@gmail.com>
Date: Fri, 11 Feb 2022 18:33:07 +0100
Simplify folder creation
Diffstat:
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/helpers/storage.ts b/helpers/storage.ts
@@ -9,11 +9,9 @@ export default class Storage {
const dir = path.join(process.cwd(), "localstorage");
const dir_with_prefix = path.join(dir, prefix);
try {
- await fs.promises.stat(dir);
await fs.promises.stat(dir_with_prefix);
} catch {
- await fs.promises.mkdir(dir);
- await fs.promises.mkdir(dir_with_prefix);
+ await fs.promises.mkdir(dir_with_prefix, { recursive: true });
}
return new Storage(prefix, dir);
} else {