keyv-dir-store 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.6](https://github.com/snomiao/keyv-dir-store/compare/v0.0.5...v0.0.6) (2024-06-27)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * - [`fs.utimes` doesn't support `number` or `string` on Windows · Issue [#33227](https://github.com/snomiao/keyv-dir-store/issues/33227) · nodejs/node]( https://github.com/nodejs/node/issues/33227 ) ([ff4981c](https://github.com/snomiao/keyv-dir-store/commit/ff4981cde2564eb9e49350d97149653d0066f850))
11
+
12
+ ### [0.0.5](https://github.com/snomiao/keyv-dir-store/compare/v0.0.4...v0.0.5) (2024-06-26)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **main:** sanitize ([ae7b162](https://github.com/snomiao/keyv-dir-store/commit/ae7b162cb8835bccda3c81769009ac0a78c7fac0))
18
+ * **main:** stage ([86d9193](https://github.com/snomiao/keyv-dir-store/commit/86d9193f5aa095ac77d006f081a3b0e801c1327e))
19
+
5
20
  ### [0.0.4](https://github.com/snomiao/keyv-dir-store/compare/v0.0.3...v0.0.4) (2024-06-26)
6
21
 
7
22
  ### [0.0.3](https://github.com/snomiao/keyv-dir-store/compare/v0.0.2...v0.0.3) (2024-06-12)
package/dist/index.js CHANGED
@@ -349,7 +349,7 @@ class KeyvDirStore {
349
349
  return name;
350
350
  }
351
351
  #path(key) {
352
- return path.join(this.#dir, this.#filename(key) + this.ext);
352
+ return path.join(this.#dir, import_sanitize_filename.default(this.#filename(key) + this.ext));
353
353
  }
354
354
  async get(key) {
355
355
  const cached = this.#cache.get(key);
@@ -382,7 +382,7 @@ class KeyvDirStore {
382
382
  this.#cache.set(key, { value, expires });
383
383
  await this.#ready;
384
384
  await writeFile(this.#path(key), value);
385
- await utimes(this.#path(key), +new Date, new Date(expires ?? 0));
385
+ await utimes(this.#path(key), new Date, new Date(expires ?? 0));
386
386
  return true;
387
387
  }
388
388
  async delete(key) {
package/index.ts CHANGED
@@ -50,7 +50,10 @@ export class KeyvDirStore implements Keyv.Store<string> {
50
50
  return name;
51
51
  }
52
52
  #path(key: string) {
53
- return path.join(this.#dir, this.#filename(key) + this.ext);
53
+ return path.join(
54
+ this.#dir,
55
+ sanitizeFilename(this.#filename(key) + this.ext)
56
+ );
54
57
  }
55
58
  async get(key: string) {
56
59
  // read memory
@@ -88,7 +91,7 @@ export class KeyvDirStore implements Keyv.Store<string> {
88
91
  await this.#ready;
89
92
  // console.log({ key, value, expires });
90
93
  await writeFile(this.#path(key), value); // create a expired file
91
- await utimes(this.#path(key), +new Date(), new Date(expires ?? 0)); // set a future expires time (0 as never expired)
94
+ await utimes(this.#path(key), new Date(), new Date(expires ?? 0)); // set a future expires time (0 as never expired)
92
95
  return true;
93
96
  }
94
97
  async delete(key: string) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keyv-dir-store",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "author": "snomiao <snomiao@gmail.com>",
5
5
  "type": "module",
6
6
  "exports": {
@@ -8,6 +8,7 @@
8
8
  "types": "./index.ts"
9
9
  },
10
10
  "module": "index.ts",
11
+ "types": "./index.ts",
11
12
  "files": [
12
13
  "*.ts",
13
14
  "dist"