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

Method readFile

packages/decap-cms-backend-forgejo/src/API.ts:317–339  ·  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

315 }
316
317 async readFile(
318 path: string,
319 sha?: string | null,
320 {
321 branch = this.branch,
322 repoURL = this.repoURL,
323 parseText = true,
324 }: {
325 branch?: string;
326 repoURL?: string;
327 parseText?: boolean;
328 } = {},
329 ) {
330 if (!sha) {
331 sha = await this.getFileSha(path, { repoURL, branch });
332 }
333 const content = await this.fetchBlobContent({
334 sha: sha as string,
335 repoURL,
336 parseText,
337 });
338 return content;
339 }
340
341 async readFileMetadata(path: string, sha: string | null | undefined) {
342 const fetchFileMetadata = async () => {

Callers

nothing calls this directly

Calls 2

getFileShaMethod · 0.95
fetchBlobContentMethod · 0.95

Tested by

no test coverage detected