libchm

Crates.iolibchm
lib.rslibchm
version0.1.0
created_at2025-12-13 02:13:56.633303+00
updated_at2025-12-13 02:13:56.633303+00
descriptionTiny wrapper around ChmLib with safe-ish helpers.
homepage
repositoryhttps://github.com/trypsynth/libchm
max_upload_size
id1982457
size25,392
Quin Gillespie (trypsynth)

documentation

README

libchm

Tiny Rust wrapper around libchm for reading CHM archives with safe-ish helpers.

Status

  • Minimal API: open a file, enumerate entries, read a file, and inspect ChmUnitInfo.
  • Bundles and builds upstream chmlib during build.rs (downloads chmlib-0.40 from jedrea.com).
  • Tested only on Windows and Linux x64, treat as experimental.

Installation

cargo ad libchm

Usage

use libchm::{ChmHandle, CHM_ENUMERATE_ALL, Result, unit_info_path};

fn main() -> Result<()> {
	let mut chm = ChmHandle::open("docs.chm")?;
	chm.enumerate(CHM_ENUMERATE_ALL, |ui| {
		println!("{}", unit_info_path(ui));
		true // keep going
	})?;
	let bytes = chm.read_file("/index.html")?;
	println!("index size: {}", bytes.len());
	Ok(())
}

Building

  • Requires a C toolchain.
  • Build script downloads and compiles chmlib-0.40 automatically (no system install needed).
  • No network? Pre-download the tarball and point Cargo to a cached source via CARGO_NET_OFFLINE or a mirror.

License

MIT for this crate. Upstream chmlib is LGPL-2.0-or-later; ensure compatibility for your use case.

Commit count: 0

cargo fmt