libarchive_oxide 0.2.0

Pure-Rust archive detection, compression, extraction, and creation
Documentation

libarchive_oxide

crates.io docs.rs License: MIT OR Apache-2.0 unsafe: forbidden

Archive detection, compression, extraction, and creation over libarchive_oxide-core.

Supported formats: tar, cpio, ar, zip, 7z, and ISO 9660. Supported filters: gzip, zstd, xz, and lz4. The crate forbids unsafe code.

This project is independent of the upstream libarchive project. It is not a binding.

Example

use std::io::Read;

use libarchive_oxide::{ArchiveReader, ReaderEvent};

fn list(input: impl Read) -> Result<(), Box<dyn std::error::Error>> {
    let mut archive = ArchiveReader::new(input);
    loop {
        match archive.next_event()? {
            ReaderEvent::Entry(metadata) => {
                println!("{}", metadata.path().display_lossy());
            }
            ReaderEvent::Done => break,
            _ => {}
        }
    }
    Ok(())
}

See docs.rs and examples.

Features

Feature Default Effect
gzip yes gzip
zstd yes zstd
xz yes xz / LZMA2
lz4 yes lz4 frame
aes no WinZip AES-256 AE-2
sevenz no 7z read/write
async no runtime-neutral futures-io adapters
tokio no Tokio I/O adapters

--no-default-features retains uncompressed formats and zip store mode.

Sequential, seek, futures-io, and Tokio adapters all drive the same archive state machines. Seek variants are named SeekArchive*, AsyncSeekArchive*, and TokioSeekArchive*; secure Tokio extraction is provided by TokioExtractor. Archive-level properties can be supplied before the first entry with set_archive_metadata.

MSRV: Rust 1.87.

Security

All high-level readers use finite Limits by default. Filesystem extraction uses a directory capability, atomic regular-file commit, and a deny-by-default policy for traversal, links, and special files. See the security policy.

License

Licensed under either MIT or Apache-2.0, at your option.