#http #reader #zip #range #cache #7z #7zip

nightly http_reader

HttpReader with cache can be used for ZipArchive, sevenz-rust and etc

3 unstable releases

0.2.1 Dec 8, 2023
0.2.0 Dec 6, 2023
0.1.2 Jun 14, 2023
0.1.1 Jun 9, 2023
0.1.0 Jun 6, 2023

#459 in Compression

LGPL-3.0

17KB
244 lines

use http_reader::HttpReader;

fn main() -> std::io::Result<()> {

    //
    //  cargo add zip
    //
    let reader = HttpReader::new("http://192.168.0.102:9212/upgrade.zip")?;
    let mut archive = zip::read::ZipArchive::new(reader)?;
    let mut file = archive.by_name("rootfs.emmc")?;
    let mut fd = std::fs::File::create("./rootfs.emmc")?;
    std::io::copy(&mut file, &mut fd)?;

    //
    //  cargo add sevenz-rust
    //
    let reader = HttpReader::new_with_bufsize("http://192.168.0.143:9212/test.7z", 12*1024*1024)?;
    // sevenz_rust::decompress_with_extract_fn(reader, "output", sevenz_rust::default_entry_extract_fn).expect("complete");
    sevenz_rust::decompress(reader, "output").expect("complete");

    Ok(())
    }

Dependencies

~4–15MB
~188K SLoC