diff --git a/code/core/src/common/utils/file-cache.ts b/code/core/src/common/utils/file-cache.ts index 590ddf60d608..d3ee7dd4ecac 100644 --- a/code/core/src/common/utils/file-cache.ts +++ b/code/core/src/common/utils/file-cache.ts @@ -85,6 +85,7 @@ export class FileSystemCache { orgOpts: CacheSetOptions | number = {} ): Promise { const opts: CacheSetOptions = typeof orgOpts === 'number' ? { ttl: orgOpts } : orgOpts; + mkdirSync(this.cache_dir, { recursive: true }); await writeFile(this.generateHash(name), this.parseSetData(name, data, opts), { encoding: opts.encoding || 'utf8', }); @@ -92,6 +93,7 @@ export class FileSystemCache { public setSync(name: string, data: T, orgOpts: CacheSetOptions | number = {}): void { const opts: CacheSetOptions = typeof orgOpts === 'number' ? { ttl: orgOpts } : orgOpts; + mkdirSync(this.cache_dir, { recursive: true }); writeFileSync(this.generateHash(name), this.parseSetData(name, data, opts), { encoding: opts.encoding || 'utf8', });