(file)
| 56 | |
| 57 | // Utility functions |
| 58 | async function writeFileToWASMMemory(file) { |
| 59 | if (!wasmModule) return 0; |
| 60 | let chunks = chunkify(file, Number(maxSize)); |
| 61 | let offset = 0; |
| 62 | let ptr = wasmModule._malloc(file.size); |
| 63 | for (let chunk of chunks) { |
| 64 | let data = new Uint8Array(await chunk.arrayBuffer()); |
| 65 | wasmModule.HEAPU8.set(data, ptr + offset); |
| 66 | offset += data.byteLength; |
| 67 | } |
| 68 | return ptr; |
| 69 | } |
| 70 | |
| 71 | async function postFileLoad() { |
| 72 | if (gui) { |
no test coverage detected