libarchive_oxide
The std high-level API of
libarchive_oxide: a unified,
streaming, pure-Rust archive library. It reads and writes tar / cpio /
ar / zip / 7z / iso9660 (incl. zip64 and WinZip AES-256), layers
gzip / zstd / xz / lz4 compression transparently over any format, and adds
auto-detection, safe filesystem extraction, and a sans-IO incremental source.
#![forbid(unsafe_code)], no dyn in library source.
An independent from-scratch reimplementation (the "oxidation" of libarchive); not
affiliated with the upstream libarchive project nor any existing libarchive
binding crate. It reuses mature pure-Rust codecs (miniz_oxide, ruzstd,
lzma-rust2, lz4_flex, RustCrypto) rather than reimplementing them, on top of
the no_std
libarchive_oxide-core algebra.
Quick start
use ;
use ;
Key entry points: decompress / decompress_capped / compress,
reader / reader_with_password, extract::extract, and the create
functions build_archive / build_tar / build_cpio. Runnable examples
are under examples/. Full API on
docs.rs.
Features
| Feature | Default | Effect |
|---|---|---|
gzip |
yes | gzip filter (hand-written sans-IO over miniz_oxide) |
zstd |
yes | zstd filter (adapter over ruzstd) |
xz |
yes | xz / LZMA2 filter (adapter over lzma-rust2) |
lz4 |
yes | lz4 frame filter (adapter over lz4_flex) |
aes |
no | WinZip AES-256 (AE-2) zip encryption/decryption (RustCrypto) |
sevenz |
no | 7z read+write (single-folder LZMA2; implies gzip) |
--no-default-features builds with the uncompressed formats only and drops every
codec dependency.
Safe on untrusted input
Extraction rejects path traversal (.., absolute paths, Windows drive/UNC), and
decompress_capped refuses to expand past a caller-set bound (bomb defense).
The whole crate is #![forbid(unsafe_code)]. See the
workspace threat model and
SECURITY.md.
MSRV
1.87, set by the codec closure. --no-default-features lowers it toward the
core floor (1.81).
License
Licensed under either of MIT or Apache-2.0 at your option.