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

Method fetchBlobContent

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

Source from the content-addressed store, hash-verified

311 }
312
313 async fetchBlobContent({ sha, repoURL, parseText }: BlobArgs) {
314 const result: GitGetBlobResponse = await this.request(`${repoURL}/git/blobs/${sha}`, {
315 cache: 'force-cache',
316 });
317
318 if (parseText) {
319 // treat content as a utf-8 string
320 const content = Base64.decode(result.content);
321 return content;
322 } else {
323 // treat content as binary and convert to blob
324 const content = Base64.atob(result.content);
325 const byteArray = new Uint8Array(content.length);
326 for (let i = 0; i < content.length; i++) {
327 byteArray[i] = content.charCodeAt(i);
328 }
329 const blob = new Blob([byteArray]);
330 return blob;
331 }
332 }
333
334 async listFiles(
335 path: string,

Callers 1

readFileMethod · 0.95

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected