MCPcopy Create free account
hub / github.com/decaporg/decap-cms / readFile

Method readFile

packages/decap-cms-backend-github/src/GraphQLAPI.ts:246–265  ·  view source on GitHub ↗
(
    path: string,
    sha?: string | null,
    {
      branch = this.branch,
      repoURL = this.repoURL,
      parseText = true,
    }: {
      branch?: string;
      repoURL?: string;
      parseText?: boolean;
    } = {},
  )

Source from the content-addressed store, hash-verified

244 }
245
246 async readFile(
247 path: string,
248 sha?: string | null,
249 {
250 branch = this.branch,
251 repoURL = this.repoURL,
252 parseText = true,
253 }: {
254 branch?: string;
255 repoURL?: string;
256 parseText?: boolean;
257 } = {},
258 ) {
259 if (!sha) {
260 sha = await this.getFileSha(path, { repoURL, branch });
261 }
262 const fetchContent = () => this.fetchBlobContent({ sha: sha as string, repoURL, parseText });
263 const content = await readFile(sha, fetchContent, localForage, parseText);
264 return content;
265 }
266
267 async fetchBlobContent({ sha, repoURL, parseText }: BlobArgs) {
268 if (!parseText) {

Callers

nothing calls this directly

Calls 2

getFileShaMethod · 0.95
readFileFunction · 0.90

Tested by

no test coverage detected