| Crates.io | kpea |
| lib.rs | kpea |
| version | 0.2.4 |
| created_at | 2024-11-17 20:44:24.768018+00 |
| updated_at | 2024-12-09 06:10:26.322548+00 |
| description | CPIO archive reader/writer library. Supports New ASCII and Old character formats. Fuzz-tested against GNU cpio. |
| homepage | https://github.com/igankevich/kpea |
| repository | https://github.com/igankevich/kpea |
| max_upload_size | |
| id | 1451539 |
| size | 71,916 |
CPIO archive reader/writer library. Supports New ASCII, New CRC, Old character, and New binary formats.
kpea is a library that offers Archive and Builder types that unpack/pack CPIO archives.
The library is fuzz-tested against GNU cpio.
To import kpea as cpio use the following syntax.
[dependencies]
cpio = { package = "kpea", version = "0.1.0" }
use kpea as cpio; // not needed if you added dependency as `cpio`
use std::fs::File;
use std::io::Error;
fn create_archive() -> Result<(), Error> {
let file = File::create("archive.cpio")?;
let mut builder = cpio::Builder::new(file);
builder.append_path("/etc/passwd", "passwd")?;
builder.append_path("/etc/group", "group")?;
builder.finish()?;
Ok(())
}
fn open_archive() -> Result<(), Error> {
let file = File::open("archive.cpio")?;
let mut archive = cpio::Archive::new(file);
while let Some(mut entry) = archive.read_entry()? {
println!("{:?}", entry.path);
}
Ok(())
}