Function
fetchGitHubFile
(
owner: string,
repo: string,
path: string,
)
Source from the content-addressed store, hash-verified
| 188 | export type FetchOptions = { maxWaitMs?: number }; |
| 189 | |
| 190 | async function fetchGitHubFile( |
| 191 | owner: string, |
| 192 | repo: string, |
| 193 | path: string, |
| 194 | ): Promise<string | null> { |
| 195 | const url = `https://raw.githubusercontent.com/${owner}/${repo}/HEAD/${path}`; |
| 196 | try { |
| 197 | const res = await fetch(url, { cache: "no-store" }); |
| 198 | if (!res.ok) return null; |
| 199 | return res.text(); |
| 200 | } catch { |
| 201 | return null; |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | async function fetchGitHubTree( |
| 206 | owner: string, |
Tested by
no test coverage detected