# libarchive_oxide
[](https://crates.io/crates/libarchive_oxide)
[](https://docs.rs/libarchive_oxide)
[](#license)
[](https://github.com/rust-secure-code/safety-dance/)
Archive detection, compression, extraction, and creation over
[`libarchive_oxide-core`](https://crates.io/crates/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
```rust
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](https://docs.rs/libarchive_oxide) and [`examples`](examples/).
## Features
| `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`](https://docs.rs/libarchive_oxide-core/latest/libarchive_oxide_core/struct.Limits.html)
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](https://github.com/P4suta/libarchive_oxide/blob/main/SECURITY.md).
## License
Licensed under either [MIT](LICENSES/MIT.txt) or
[Apache-2.0](LICENSES/Apache-2.0.txt), at your option.