MCPcopy Index your code
hub / github.com/VPSDance/ai-proxy-rules / fetch

Method fetch

scripts/sync/cache.ts:26–34  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

24 constructor(private cacheDir: string) {}
25
26 async fetch(url: string): Promise<string> {
27 return this.cached(url, async () => {
28 const response = await fetch(url);
29 if (!response.ok) {
30 throw new Error(`HTTP ${response.status} ${response.statusText}`);
31 }
32 return response.text();
33 });
34 }
35
36 async cached(key: string, fresh: () => Promise<string>): Promise<string> {
37 this.usedKeys.add(this.cacheKey(key));

Callers 2

syncFunction · 0.95
cache.test.tsFile · 0.80

Calls 1

cachedMethod · 0.95

Tested by

no test coverage detected