Skip to content

feat: replace zipfile with zipread in epub #3268

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

Merged
merged 1 commit into from
Mar 13, 2025
Merged

Conversation

beyondkmp
Copy link
Collaborator

The zipfile(https://github.com/mapbox/node-zipfile) package currently fails to compile on Node.js 12 and above across Mac/Windows/Linux platforms, and doesn't support Mac ARM or Windows ARM architectures. When using the epub library, requiring zipfile fails, defaulting to adm-zip instead.

https://github.com/CherryHQ/cherry-studio/actions/runs/13823838151/job/38674953209
image

https://github.com/CherryHQ/cherry-studio/actions/runs/13823838151/job/38674953218
image

zipread uses Node.js's built-in zlib library, offering similar performance to zipfile without requiring compilation, and supports Mac ARM/Windows ARM architectures. Please consider replacing the zipfile package with this alternative.

https://github.com/szastupov/zipread
zipread is a ZIP file reader designed for speed and memory efficiency. Unlike other modules, it doesn't read the whole file into memory and uses native ZLIB functions for decompression.

@beyondkmp
Copy link
Collaborator Author

I've submitted it to upstream(julien-c/epub#60), but since the upstream merge might take some time, I'm also submitting it here for your consideration.

Another benefit is that after removing zipfile, the total package size on Windows has decreased from 90,876KB to 87,331KB, reducing it by nearly 3MB.
image
image

@kangfenmao kangfenmao merged commit c2ff5f3 into CherryHQ:main Mar 13, 2025
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

Successfully merging this pull request may close these issues.

2 participants