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

Method fetchBlobContent

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

Source from the content-addressed store, hash-verified

361 }
362
363 async fetchBlobContent({ sha, repoURL, parseText }: BlobArgs) {
364 const result: GitGetBlobResponse = await this.request(`${repoURL}/git/blobs/${sha}`, {
365 cache: 'force-cache',
366 });
367
368 if (parseText) {
369 // treat content as a utf-8 string
370 const content = Base64.decode(result.content);
371 return content;
372 } else {
373 // treat content as binary and convert to blob
374 const content = Base64.atob(result.content);
375 const byteArray = new Uint8Array(content.length);
376 for (let i = 0; i < content.length; i++) {
377 byteArray[i] = content.charCodeAt(i);
378 }
379 const blob = new Blob([byteArray]);
380 return blob;
381 }
382 }
383
384 async listFiles(
385 path: string,

Callers 1

readFileMethod · 0.95

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected