MCPcopy Create free account
hub / github.com/VPSDance/ai-proxy-rules / readIndex

Method readIndex

scripts/sync/cache.ts:128–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 });

Callers 2

pruneOrphansMethod · 0.95
writeMethod · 0.95

Calls 1

indexFileMethod · 0.95

Tested by

no test coverage detected