(cacheDir: string, key: string)
| 99 | |
| 100 | await writeFile(options.output, renderMarkdown(rows), "utf8"); |
| 101 | console.log(`[status] wrote ${options.output} (${rows.length} providers)`); |
| 102 | } |
| 103 | |
| 104 | async function statCacheFile(cacheDir: string, key: string): Promise<{ mtime: Date } | null> { |
| 105 | const hash = createHash("sha256").update(key).digest("hex").slice(0, 16); |
| 106 | const file = path.join(cacheDir, `${hash}.txt`); |
| 107 | try { |
| 108 | const stats = await stat(file); |
| 109 | return { mtime: stats.mtime }; |
| 110 | } catch { |
| 111 | return null; |
| 112 | } |
| 113 | } |