#extension #lha #unlha #lzh

no-std delharc

A library for parsing and extracting files from LHA/LZH archives

9 releases (5 breaking)

0.6.1 May 1, 2024
0.6.0 Mar 1, 2024
0.5.0 Jul 13, 2023
0.4.0 Oct 4, 2021
0.1.0 Jul 5, 2020

#56 in Compression

Download history 95/week @ 2024-08-10 95/week @ 2024-08-17 374/week @ 2024-08-24 460/week @ 2024-08-31 366/week @ 2024-09-07 151/week @ 2024-09-14 174/week @ 2024-09-21 452/week @ 2024-09-28 307/week @ 2024-10-05 355/week @ 2024-10-12 147/week @ 2024-10-19 248/week @ 2024-10-26 610/week @ 2024-11-02 162/week @ 2024-11-09 153/week @ 2024-11-16 144/week @ 2024-11-23

1,119 downloads per month
Used in 5 crates (4 directly)

MIT/Apache

165KB
3.5K SLoC

delharc

Crate Docs Build Status Coverage Status Minimum rustc version

A Rust library for parsing and extracting content of LHA/LZH archives.

What it does

This library provides ways to parse the content of LHA headers and allows to read files, compressed with some of the methods used by the archive format.

Files using this format usually have .lzh or .lha extensions. Some formats, such as the retro chip-tune YM format, use LHA as its default packaging method. The entire content of the Aminet has also been packaged using this format.

What it doesn't do

This library does not provide high level methods for creating files or directories from the extracted archives.

Usage

Add to Cargo.toml:

[dependencies]
delharc = "0.6"

For more information, please see the Documentation.

No std

Since version 0.6 delharc can be used without the std library. In this instance the alloc external crate will be required instead.

[dependencies.delharc]
version = "0.6"
default-features = false
features = ["lh1", "lz"] # select desired features

delharc API was originally built around the std::io types such as io::Error and io::Read.

This design choice made it impossible to adapt delharc to be used in the absence of the std::io library without some significant implementation changes.

To work around this problem the stub_io module and error module was added. stub_io contains an I/O proxy trait Read and a Take type which are now used as interfaces for generic types throughout the library. Instead of relying on io::Error for fallible results delharc defines its own error::LhaError which encapsulates an I/O error type.

With std library enabled, error::LhaError converts to io::Error via the From trait and stub_io::Read is implemented for all types that implement io::Read.

For std users the difference from previous versions is that methods previously returning io::Result now return Result<_, LhaError<io::Error>>. This might break cases when result Err(error) from calls to delharc methods is returned as is without the ? or From conversion.

Now, when using default-features = false the std feature needs to be added back along with other compression method features.

Rust Version

delharc requires Rustc version 1.63 or greater due to the stabilized array::from_fn function in this version.

License

This project is licensed under either of

at your option.

Dependencies

~1.1–6MB
~30K SLoC