diff --git a/src/services/cache.ts b/src/services/cache.ts index df1d96e0..60a0a1a5 100644 --- a/src/services/cache.ts +++ b/src/services/cache.ts @@ -45,10 +45,6 @@ export const getCacheStats = async (filename: string, settings: Settings) => { export const getHashOf = async (filename: string, settings: Settings) => { const hashesFilename = path.resolve(settings.cacheFolder, '__hashes.json') - if (!(await fileExists(hashesFilename))) { - return undefined - } - try { const hashes = JSON.parse(await fs.readFile(hashesFilename, { encoding: 'utf-8' })) as Record return hashes[filename] @@ -64,11 +60,9 @@ export const saveHashOf = async (filename: string, hash: string, settings: Setti let hashes: Record = {} - if (await fileExists(hashesFilename)) { - try { - hashes = JSON.parse(await fs.readFile(hashesFilename, { encoding: 'utf-8' })) as Record - } catch (e: unknown) {} - } + try { + hashes = JSON.parse(await fs.readFile(hashesFilename, { encoding: 'utf-8' })) as Record + } catch (e: unknown) {} hashes[filename] = hash