MCPcopy Create free account
hub / github.com/idosal/git-mcp / fetchRawFile

Function fetchRawFile

src/api/utils/githubClient.ts:305–324  ·  view source on GitHub ↗
(
  owner: string,
  repo: string,
  branch: string,
  path: string,
  env: Env,
  useAuth = false,
)

Source from the content-addressed store, hash-verified

303 * @param useAuth - Whether to use authentication
304 */
305export async function fetchRawFile(
306 owner: string,
307 repo: string,
308 branch: string,
309 path: string,
310 env: Env,
311 useAuth = false,
312): Promise<string | null> {
313 const url = constructGithubUrl(owner, repo, branch, path);
314
315 // Raw GitHub content doesn't need the GitHub API token
316 // But we still use the client for rate limiting
317 const response = await githubApiRequest(url, {}, env, 0, useAuth);
318
319 if (!response || !response.ok) {
320 return null;
321 }
322
323 return response.text();
324}

Callers 1

fetchFileFromGitHubFunction · 0.85

Calls 3

constructGithubUrlFunction · 0.90
githubApiRequestFunction · 0.85
textMethod · 0.65

Tested by

no test coverage detected