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

Move to node-unrar-js for cbr and node-stream-zip for cbz #3435

Merged
merged 3 commits into from
Sep 18, 2024

Conversation

mikiher
Copy link
Contributor

@mikiher mikiher commented Sep 18, 2024

This is a continuation of PR #3422, and more comprehensively fixes #3406, fixes #3399, and fixes #2526.

I looked for a replacement for libarchive for extraction from cbr (rar) files. I found node-unrar-js which seems to work similarly to libarchive (with the extraction algorithm implemented in a wasm module), and which seems to work well on a few files that libarchive failed on, and additionally doesn't require loading the full cbr into a buffer. The npm package is minimal and has 0 dependencies.

Additionally, I moved from libarchive to our existing libs/nodeStreamZip implementation for cbz files.

The old libarchive implementation as well as the new implementations are all wrapped with the same interface, and parseComicMetadata was modified to use that interface.

I'm temporarily keeping the libarchive implementation so that we can move back to it in case we have any serious issues with the new implementations. Will remove it in a couple of weeks.

@mikiher mikiher marked this pull request as ready for review September 18, 2024 05:54
@Nda70
Copy link

Nda70 commented Sep 18, 2024

Thanks a lot for your hard work and perseverance.

@mikiher
Copy link
Contributor Author

mikiher commented Sep 18, 2024

The last commit cleans up empty directories in the extraction temp dir (this can happen when the extracted file is not in the archive's root)

@advplyr
Copy link
Owner

advplyr commented Sep 18, 2024

I tested on my comic library and it is working well.

Since node-unrar-js is using WASM it could also be used in the client, while libarchive is still used for cbz's.
The comic reader could be refactored to get each page/image from the server. The only issue with that is handling downloaded comics in the mobile apps.

Thanks!

@advplyr advplyr merged commit 8f96d20 into advplyr:master Sep 18, 2024
5 checks passed
@mikiher mikiher deleted the comic-book-extractors branch November 18, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants