Skip to content

Commit 46a2c9d

Browse files
authored
fix(node-localstorage): use native fs (#44)
1 parent 985287b commit 46a2c9d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/node-localstorage/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"dependencies": {
4848
"@kvs/storage": "^2.1.4",
4949
"app-root-path": "^3.1.0",
50-
"mkdirp": "^3.0.1",
5150
"node-localstorage": "^2.1.6"
5251
},
5352
"devDependencies": {

packages/node-localstorage/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import path from "path";
22
import { JsonValue, KvsStorage, kvsStorage } from "@kvs/storage";
33
import { KVS, KVSOptions } from "@kvs/types";
4+
import fs from "node:fs/promises";
45
// @ts-ignore
56
import { LocalStorage } from "node-localstorage";
67
// @ts-ignore
78
import appRoot from "app-root-path";
8-
import { mkdirp } from "mkdirp";
99

1010
export type KvsLocalStorageSchema = {
1111
[index: string]: JsonValue;
@@ -20,7 +20,9 @@ export const kvsLocalStorage = async <Schema extends KvsLocalStorageSchema>(
2020
): Promise<KvsStorage<Schema>> => {
2121
const defaultCacheDir = path.join(appRoot.toString(), ".cache");
2222
if (!options.storeFilePath) {
23-
await mkdirp(defaultCacheDir);
23+
await fs.mkdir(defaultCacheDir, {
24+
recursive: true
25+
});
2426
}
2527
const saveFilePath = options.storeFilePath
2628
? options.storeFilePath

0 commit comments

Comments
 (0)