(base64: string)
| 596 | }; |
| 597 | |
| 598 | const bytesFromBase64 = (base64: string): Uint8Array => { |
| 599 | const binary = atob(base64); |
| 600 | const bytes = new Uint8Array(binary.length); |
| 601 | for (let index = 0; index < binary.length; index += 1) { |
| 602 | bytes[index] = binary.charCodeAt(index); |
| 603 | } |
| 604 | return bytes; |
| 605 | }; |
| 606 | |
| 607 | const decodeTextFile = (file: ToolFileValue): string => { |
| 608 | const text = new TextDecoder("utf-8", { fatal: false }).decode(bytesFromBase64(file.data)); |