Crates.io | simple-archive |
lib.rs | simple-archive |
version | 0.3.0 |
source | src |
created_at | 2024-07-17 18:57:26.2216 |
updated_at | 2024-08-13 19:43:54.101037 |
description | Slim library to simplify handling compressed archives in Rust based on libarchive |
homepage | https://github.com/jaimecura/simple-archive.git |
repository | https://github.com/jaimecura/simple-archive.git |
max_upload_size | |
id | 1306460 |
size | 172,075 |
simple-archive
is the simplest possbible crate to handle compressed archives and file streams.
Under the hood it uses the libarchive library to handle data. There is a direct ffi covnersion from the libarchive library that can also be used, but the purpose of the library is to provide a simpler API in the rust world on top of libarchive.
libarchive
must be installed. At the time of this writing the only version tested with the
library is 3.7.4. Older version might work just fine, but it's simply untested
Since libarchive
is an umbrella on top of other libraries, depending on the desired data
format to be handled, additional libraries should also be installed in the system.
Compress files
use std::fs::File;
let output = File::create("tests/fixtures_out/compressed.tar.gz").unwrap();
let mut a = ArchiveWriter::new(output).unwrap();
a.set_output_targz().unwrap();
a.open().unwrap();
a.add_file("/path/to/your/file", "path/inside/output/archive").unwrap();
Uncompress files
use std::fs::File;
let input = File::open("tests/fixtures_out/compressed.tar.gz").unwrap();
let mut a = ArchiveReader::new(output).unwrap();
...
Licensed under either of