Crates.io | vach |
lib.rs | vach |
version | 0.7.2 |
created_at | 2021-09-11 17:26:23.137211+00 |
updated_at | 2025-08-07 16:08:47.458259+00 |
description | A simple archiving format, designed for storing assets in compact secure containers |
homepage | |
repository | https://github.com/zeskeertwee/vach |
max_upload_size | |
id | 449789 |
size | 83,203 |
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.
io::Seek
and io::Read
, for example a file (fs::File
) or in memory buffer (io::Cursor<Vec<u8>>
).footstep1.wav
in sounds.vach
.vach
source on an corresponding leaf
. 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.
builder
or the loader
modules.Some(examples)
instead of None
If you appreciate the works of this repo, consider dropping a star. It will be much appreciated; 🌟