zarust 0.2.1

Rust implementation of the ZArchive format
Documentation
# zarust


[![Crates.io](https://img.shields.io/crates/v/zarust.svg)](https://crates.io/crates/zarust)
[![Downloads](https://img.shields.io/crates/d/zarust.svg)](https://crates.io/crates/zarust)

Rust implementation of the [ZArchive](https://github.com/Exzap/ZArchive) format (`.zar` / `.wua`).

## Command line


```
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 |

```bash
zarust pack ./game game.zar
```

Options 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`](https://no-color.org).
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:

```bash
zarust ./game       # packs to ./game.zar
zarust game.zar     # extracts to ./game_extracted
```

## Library


[`ArchiveReader`] accepts any seekable reader and [`ArchiveWriter`] accepts any
writer; the binary is a filesystem adapter over them.

```rust
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.

[`ArchiveReader`]: https://docs.rs/zarust/latest/zarust/struct.ArchiveReader.html
[`ArchiveWriter`]: https://docs.rs/zarust/latest/zarust/struct.ArchiveWriter.html

## License


MIT-0