7 releases (breaking)
| 0.7.0 | Sep 30, 2023 |
|---|---|
| 0.6.0 | Sep 24, 2023 |
| 0.5.1 | Sep 23, 2023 |
| 0.4.0 | Sep 17, 2023 |
| 0.1.0 |
|
#920 in Compression
53 downloads per month
36KB
632 lines
Arkiv
Arkiv is a convenience library to download, open, consult and extract archives of various format through a single consistent interface.
Supported Formats
sample.zip(requires the zip feature).sample.tar(requires thetarfeature).sample.tgzorsample.tar.gz(requirestarandgzipfeatures).sample.tar.xz(requirestarandxzfeatures).sample.tar.bz2(requirestarandbzipfeatures).sample.tar.zstdorsample.tar.zst(requirestarandzstdfeatures).
Usage
use arkiv::{Result, Archive};
fn main() -> Result<()> {
// open the archive from a local file
let mut archive = arkiv::Archive::open("path/to/archive.tar.xz")?;
// or download it over HTTP(S) - requires the `download` feature.
#[cfg(feature="download")]
let mut archive = {
let url = "https://github.com/meuter/arkiv-rs/raw/main/tests/sample/sample.tar.zstd";
arkiv::Archive::download(url)?
};
// iterate over entries
for entry in archive.entries_iter()? {
let entry = entry?;
println!("{} {}", entry.size(), entry.path().display());
}
// extract the archive (perserves permission on unix targets)
archive.unpack("/tmp/")?;
Ok(())
}
Dependencies
~5–12MB
~243K SLoC