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

Method fetchBlobContent

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

Source from the content-addressed store, hash-verified

711 }
712
713 async fetchBlobContent({ sha, repoURL, parseText }: BlobArgs) {
714 const result: Endpoints['GET /repos/{owner}/{repo}/git/blobs/{file_sha}']['response']['data'] =
715 await this.request(`${repoURL}/git/blobs/${sha}`, {
716 cache: 'force-cache',
717 });
718
719 if (parseText) {
720 // treat content as a utf-8 string
721 const content = Base64.decode(result.content);
722 return content;
723 } else {
724 // treat content as binary and convert to blob
725 const content = Base64.atob(result.content);
726 const byteArray = new Uint8Array(content.length);
727 for (let i = 0; i < content.length; i++) {
728 byteArray[i] = content.charCodeAt(i);
729 }
730 const blob = new Blob([byteArray]);
731 return blob;
732 }
733 }
734
735 async listFiles(
736 path: string,

Callers 1

readFileMethod · 0.95

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected