5
0
mirror of git://git.proxmox.com/git/pxar.git synced 2024-12-22 21:33:50 +03:00
pxar/examples/apxar.rs
Christian Ebner 3ee98e1072 decoder/accessor: allow for split input stream variant
When a pxar archive was encoded using the split stream output
variant, access to the payload of regular files has to be redirected
to the corresponding dedicated input.

Allow to pass the split input variant to the decoder and accessor
instances to handle the split streams accordingly and decode split
stream archives.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2024-06-05 09:24:22 +02:00

20 lines
553 B
Rust

use pxar::decoder::aio::Decoder;
#[tokio::main]
async fn main() {
let mut args = std::env::args_os().skip(1);
let file = args.next().expect("expected a file name");
let file = tokio::fs::File::open(file)
.await
.expect("failed to open file");
let mut reader = Decoder::from_tokio(pxar::PxarVariant::Unified(file))
.await
.expect("failed to open pxar archive contents");
while let Some(entry) = reader.next().await {
println!("{:#?}", entry.expect("failed to parse entry").path());
}
}