A simple archiving format, written in Pure Rust.
vach
, pronounced like "duck" but with a "v", is an archiving and resource transmission format. It was built to be secure, contained and protected. vach
also has in-built support for multiple compression schemes (LZ4, Snappy and Brolti), cryptographic hashing, custom flags per entry and encryption. Check out the vach
spec at spec.txt. Any and all help will is much appreciated.
- Archive Source: Any source of data. That implements
io::Seek
andio::Read
, for example a file (fs::File
) or in memory buffer (io::Cursor<Vec<u8>>
). - Leaf: Any actual data endpoint within an archive, for example
footstep1.wav
insounds.vach
. - Entry: Some data in the registry section of a
vach
source on an correspondingleaf
. For example,{ id: footstep.wav, location: 45, offset: 2345, flags: 0b0000_0000_0000_0000u16 }
.
let mut target = Cursor::new(vec![]);
// Data to be written
let data_1 = b"Around The World, Fatter better stronker" as &[u8];
let data_2 = b"Imagine if this made sense" as &[u8];
let data_3 = b"Fast-Acting Long-Lasting, *Bathroom Reader*" as &[u8];
// Builder definition
let config = BuilderConfig::default();
// Add data
let mut leaves = [
Leaf::new(data_1, "d1").compress(CompressMode::Always),
Leaf::new(data_2, "d2").compress(CompressMode::Never),
Leaf::new(data_3, "d3").compress(CompressMode::Detect) // picks the smaller of the compressed and uncompressed
];
// write archive
dump(&mut target, &mut leaves, &config, None)?;
// Load data
let archive = Archive::new(target)?;
// Quick assertions
assert_eq!(archive.fetch("d1")?.data.as_slice(), data_1);
assert_eq!(archive.fetch("d2")?.data.as_slice(), data_2);
assert_eq!(archive.fetch("d3")?.data.as_slice(), data_3);
For more information on how to use the library, read the documentation. Always read the documentation! or read the tests, they offer great insight into how the crate works.
- An CLI:
- Data encryption.
- Benchmarks.
- Features to turn off (or to turn on) either the
builder
or theloader
modules. -
Some(examples)
instead ofNone
- Skynet, (coming very soon).
- Some proper benchmarking code. (Call for participation)
If you appreciate the works of this repo, consider dropping a star. It will be much appreciated; 🌟