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