1use rust_car::{
2 reader::{self, CarReader},
3 utils::extract_ipld_to_current_path,
4};
5
6fn main() {
10 let file_name = std::env::args().nth(1);
11 let path = file_name.as_ref().map(|f| f.into()).unwrap_or_else(|| {
12 let file = std::path::Path::new("test");
13 file.join("carv1-basic.car")
14 });
15 let file = std::fs::File::open(path).unwrap();
16 let mut reader = reader::new_v1(file).unwrap();
17 let roots = reader.header().roots();
18 for r in roots.iter() {
19 extract_ipld_to_current_path(&mut reader, *r).unwrap();
20 }
21}