#ipld #car #ipfs

rs-car-sync

Rust implementation of the CAR v1 and v2 specifications using standard sync api

1 unstable release

new 0.4.1 Dec 14, 2024

#5 in #car

Download history 115/week @ 2024-12-09

115 downloads per month

MIT/Apache

1.5MB
714 lines

rs-car-sync

This is a fork of rs-car that only uses standard sync rust api.

The main motivation is to get rid of useless contaminating async api when reading a car file from memory.

Rust implementation of the CAR specifications, both CARv1 and CARv2.

Usage

let mut file = std::fs::File::open(car_filepath).unwrap();
let block_iterator = decode_car_stream(&mut file, true).unwrap();

while let Some(item) = block_iterator.next() {
    let (cid, block) = item.unwrap();
    // Do something with CAR block
}

lib.rs:

Rust implementation of the CAR specifications, both CARv1 and CARv2.

Usage

  • To get a block iterator [CarReader::new()]
  • To read all blocks in memory [car_read_all]

Dependencies

~3.5MB
~76K SLoC