(base64: string)
| 358 | }; |
| 359 | |
| 360 | const bytesFromBase64 = (base64: string): Uint8Array => { |
| 361 | const binary = atob(base64); |
| 362 | const bytes = new Uint8Array(binary.length); |
| 363 | for (let index = 0; index < binary.length; index += 1) { |
| 364 | bytes[index] = binary.charCodeAt(index); |
| 365 | } |
| 366 | return bytes; |
| 367 | }; |
| 368 | |
| 369 | const decodeTextFile = (file: ToolFileValue): string => { |
| 370 | const text = new TextDecoder("utf-8", { fatal: false }).decode(bytesFromBase64(file.data)); |