12345678910 |
- import { createChunk } from "./createChunk";
- self.onmessage = async (e) => {
- const { file, chunkSize, startChunkIndex, endChunkIndex } = e.data;
- const proms = [];
- for(let i = startChunkIndex; i < endChunkIndex; i++){
- proms.push(createChunk(file, chunkSize, i));
- }
- const chunk = await Promise.all(proms);
- postMessage(chunk);
- };
|