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

Method readFile

packages/decap-cms-backend-github/src/GraphQLAPI.ts:243–262  ·  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

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

Callers

nothing calls this directly

Calls 2

getFileShaMethod · 0.95
readFileFunction · 0.90

Tested by

no test coverage detected