(file)
| 749 | * @param {number} file.size - File size in bytes |
| 750 | */ |
| 751 | const processFile = async (file) => { |
| 752 | try { |
| 753 | const response = await fetch(file.path); |
| 754 | const reader = response.body.getReader(); |
| 755 | |
| 756 | console.log(`File fetched: ${file.path}, size: ${file.size}`); |
| 757 | |
| 758 | while (true) { |
| 759 | // deno-lint-ignore no-await-in-loop |
| 760 | const { value, done } = await reader.read(); |
| 761 | if (done) break; |
| 762 | // Allocate and copy chunk data |
| 763 | jsAppendFileUint8(moduleInstance, file.path, value); |
| 764 | } |
| 765 | } catch (error) { |
| 766 | console.error(`Error processing file ${file.path}:`, error); |
| 767 | } |
| 768 | }; |
| 769 | |
| 770 | /** |
| 771 | * Fetches all files in parallel and calls completion callback |
no test coverage detected