()
| 126 | } |
| 127 | |
| 128 | private async readIndex(): Promise<Record<string, string>> { |
| 129 | if (this.indexCache !== null) { |
| 130 | return this.indexCache; |
| 131 | } |
| 132 | try { |
| 133 | const raw = await readFile(this.indexFile(), "utf8"); |
| 134 | this.indexCache = JSON.parse(raw) as Record<string, string>; |
| 135 | } catch { |
| 136 | this.indexCache = {}; |
| 137 | } |
| 138 | return this.indexCache; |
| 139 | } |
| 140 | |
| 141 | private async write(url: string, text: string): Promise<void> { |
| 142 | await mkdir(this.cacheDir, { recursive: true }); |
no test coverage detected