@file-cache/core
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "@file-cache/core", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A cache for file metadata or file content.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -22,4 +22,6 @@ import fs from "node:fs/promises"; | ||
export const createFileCache = async (cacheFilePath: string, mode: "content" | "metadata") => { | ||
// When mode is changed, create another cache | ||
const cacheFileFullPath = cacheFilePath + mode; | ||
// file <-> Map | ||
let fileCacheMap = await readFileCache(cacheFilePath + mode); | ||
let fileCacheMap = await readFileCache(cacheFileFullPath); | ||
// Processing Map | ||
@@ -90,3 +92,3 @@ const entryMap = new Map<string, CacheValue>(fileCacheMap); | ||
try { | ||
await fs.writeFile(cacheFilePath, JSON.stringify(Object.fromEntries(entryMap)), "utf-8"); | ||
await fs.writeFile(cacheFileFullPath, JSON.stringify(Object.fromEntries(entryMap)), "utf-8"); | ||
// reflect the changes in the cacheMap | ||
@@ -93,0 +95,0 @@ fileCacheMap = new Map(entryMap); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40977
756