Large file reading or processing in javascript can cause a lot of issues, For example, but not limited to:
- page crash
- interactivity go wrong (UI freeze)
- Violation warning message in chrome based browsers ([Violation] change/load handler took xxxxms)
TypedArray can help us to deal with big files as chunks so we can read/process every chunk of the file instead of the whole file at once.
The worker thread can perform tasks without interfering with the user interface. Thanks for that 🙏
- First clone the project.
- You can run the project using VSCODE live server.
- In case you want to edit any of the TS files you can run the tsc watch script.
npm install
npm run start
- First you need to have a large file in your machine or you can download a large file from this link.
- To test slower processing just comment out line 89 and uncomment from line 67 to 81.