Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Jszip in Angular to export 1-2 MB files considerably slows down UI #902

Closed
bastientardits opened this issue Jul 4, 2023 · 2 comments

Comments

@bastientardits
Copy link

Hello, I have been working on an Angular service who's goal is to export several html files into a zip folder. The service works perfectly fine, however when I download large folders, the UI is considerably slown, most likely due to the export clogging the memory. I have read the documentation about the limtations of jszip. However, the solutions offered there seem to only work in node.js with server-side node streaming.
Has anybody found a solution for this? Functions like https://stuk.github.io/jszip/documentation/api_jszip/generate_node_stream.html are non existant in angular client side. If yes, I would very much appreciate a link to an example repo.
The issue is non existant once the page using the service is refreshed, but it seems a rather harsh solution because it really disturbs the UI.
Thanks

@linhub15
Copy link

linhub15 commented Aug 1, 2023

It might be possible to move the execution into a Web Worker.

The execution will happen asynchronously and when the Promise resolves you can postMessage() back to the component that registered the worker.

@bastientardits
Copy link
Author

Hi @linhub15 thanks for your comment. Unfortunately I haven't found the answer to this specific problematic, but I did find out what the problem was on my end. Some of the content generated on the website (graphs with ngx-graph) that I put on the html exported files as svg was never actually destroyed and completely clogged the memory when generating the jsZIP. It all works fine currently for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants