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

Method fetchBlobContent

packages/decap-cms-backend-github/src/API.ts:685–705  ·  view source on GitHub ↗
({ sha, repoURL, parseText }: BlobArgs)

Source from the content-addressed store, hash-verified

683 }
684
685 async fetchBlobContent({ sha, repoURL, parseText }: BlobArgs) {
686 const result: Endpoints['GET /repos/{owner}/{repo}/git/blobs/{file_sha}']['response']['data'] =
687 await this.request(`${repoURL}/git/blobs/${sha}`, {
688 cache: 'force-cache',
689 });
690
691 if (parseText) {
692 // treat content as a utf-8 string
693 const content = Base64.decode(result.content);
694 return content;
695 } else {
696 // treat content as binary and convert to blob
697 const content = Base64.atob(result.content);
698 const byteArray = new Uint8Array(content.length);
699 for (let i = 0; i < content.length; i++) {
700 byteArray[i] = content.charCodeAt(i);
701 }
702 const blob = new Blob([byteArray]);
703 return blob;
704 }
705 }
706
707 async listFiles(
708 path: string,

Callers 1

readFileMethod · 0.95

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected