| 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, |