MCPcopy Create free account
hub / github.com/cli/cli / fileContent

Method fileContent

evals/src/core/github.ts:124–130  ·  view source on GitHub ↗

Reads a text file from a repository at a ref.

(repo: string, path: string, ref: string)

Source from the content-addressed store, hash-verified

122
123 /** Reads a text file from a repository at a ref. */
124 async fileContent(repo: string, path: string, ref: string): Promise<string> {
125 const file = await this.api<{ encoding: string; content: string }>(
126 "GET", `/repos/${repo}/contents/${path}?ref=${encodeURIComponent(ref)}`,
127 );
128 if (file.encoding !== "base64") throw new Error(`Unexpected ${path} encoding`);
129 return Buffer.from(file.content, "base64").toString("utf8");
130 }
131}

Callers 1

greetingMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected