Rust implementation of the ZArchive format (.zar / .wua).
zarust <command> [options]
| Command | Description |
|---|---|
pack <dir> [archive] |
Create an archive from a directory |
extract <archive> [dir] |
Extract an archive into a directory |
list <archive> [path] |
List the entries in an archive |
info <archive> |
Show sizes and the compression ratio |
verify <archive> |
Check the stored integrity hash |
zarust pack ./game game.zarOptions may appear before or after the command: -o/--output, -f/--force,
-v/--verbose, -q/--quiet, --tree, --check, --no-progress,
--color <auto|always|never>, -h/--help, -V/--version.
Progress is drawn on stderr only when it is a terminal, so piped output stays
clean. Color follows the terminal and honours NO_COLOR.
Exit codes are 0 success, 1 failure, 2 usage error.
Given a bare path, zarust packs a directory or extracts an archive, matching
the original ZArchive tool:
zarust ./game # packs to ./game.zar
zarust game.zar # extracts to ./game_extractedArchiveReader accepts any seekable reader and ArchiveWriter accepts any
writer; the binary is a filesystem adapter over them.
use zarust::{ArchiveReader, ArchiveWriter, EntryKind};
let mut writer = ArchiveWriter::new(std::io::Cursor::new(Vec::new()));
writer.make_dir("Games", false)?;
writer.add_file("Games/readme.txt", &b"hello ZArchive"[..])?;
let bytes = writer.finish()?.into_inner();
let mut reader = ArchiveReader::new(std::io::Cursor::new(bytes))?;
let file = reader.lookup_kind("games/README.TXT", Some(EntryKind::File)).unwrap();
assert_eq!(reader.read_file_to_end(file)?, b"hello ZArchive");
assert!(reader.verify_integrity()?);
# Ok::<(), zarust::Error>(())Path lookups are ASCII case-insensitive and accept either separator, as the format requires.
MIT-0