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

Method fetchBlobContent

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

Source from the content-addressed store, hash-verified

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

Callers 1

readFileMethod · 0.95

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected