extract_ipld_to_current_path

Function extract_ipld_to_current_path 

Source
pub fn extract_ipld_to_current_path(
    reader: &mut impl CarReader,
    cid: Cid,
) -> Result<(), CarError>
Expand description

extract files to current path from CAR file. cid is the root cid

Examples found in repository?
examples/extract.rs (line 19)
9fn 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}