Crates.io | archive-reader |
lib.rs | archive-reader |
version | 0.3.5 |
source | src |
created_at | 2023-01-22 16:53:17.210671 |
updated_at | 2023-02-27 23:00:20.262315 |
description | Library for reading files from archives |
homepage | https://github.com/YaxinCheng/archive-reader |
repository | https://github.com/YaxinCheng/archive-reader |
max_upload_size | |
id | 765259 |
size | 31,058 |
ArchiveReader
is a library that wraps partial read functions from libarchive.
It provides rustic interface over listing file names and reading given files within archives.
[dependencies]
archive-reader = "0.3"
use archive_reader::Archive;
use archive_reader::error::Result;
fn main() -> Result<()> {
let mut archive = Archive::open("some_archive.zip");
let file_names = archive
.block_size(1024 * 1024)
.list_file_names()?
.collect::<Result<Vec<_>>>()?;
let mut content = vec![];
let _ = archive.read_file(&file_names[0], &mut content)?;
println!("content={:?}", content);
Ok(())
}
lending_iter
- Enables LendingIterator
implementation, which avoids heap allocations for read_file_by_block
functions.This section talks about compiling this project
pkg-config --libs --cflags libarchive 'libarchive >= 3.2.0'
cd SOME_DIR
git clone git@github.com:YaxinCheng/archive-reader.git
cd archive-reader
cargo build --release