simple-archive

Crates.iosimple-archive
lib.rssimple-archive
version0.3.0
sourcesrc
created_at2024-07-17 18:57:26.2216
updated_at2024-08-13 19:43:54.101037
descriptionSlim library to simplify handling compressed archives in Rust based on libarchive
homepagehttps://github.com/jaimecura/simple-archive.git
repositoryhttps://github.com/jaimecura/simple-archive.git
max_upload_size
id1306460
size172,075
(jaimecura)

documentation

README

simple-archive

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.


Dependencies

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.

Features

  • read file formats compatible with libarchive
  • filters on top of output format files supported by libarchive
  • directly compress source data object with Read+Seek traits
  • extract objects from archive data.

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();
...

License

Licensed under either of

Commit count: 0

cargo fmt