Quickstart
This walks the whole tool in one sitting. Point it at any directory you have lying around; the numbers below come from a 56-file asset tree.
-
Pack a directory
Terminal window $ zpack pack assets/ game.zpakPacked 56 files (77.2 MiB -> 71.7 MiB, 7.1% smaller)Every file under
assets/is walked recursively. Each one is deflated, and kept compressed only if that came out smaller - which is why an asset tree that is mostly PNGs and Ogg files barely shrinks. Nothing grows. -
See what is in it
Terminal window $ zpack list game.zpakaudio/void_mp_emh_1.wav 35.2 MiB deflate 32.4 MiBtextures/asphalt_old_pt_1.png 153.2 KiB store 153.2 KiBtextures/ui/label.txt 6 B store 6 BColumns are path, original size, method, and stored size. The index lives at the head of the file, so this reads a few kilobytes rather than the whole archive -
liston a 70 MiB archive costs the same as on a 70 KiB one. -
Check it is intact
Terminal window $ zpack verify game.zpakVerified 56 entriesThis one does read everything: each entry is decompressed and rehashed against the hash recorded when it was packed. It writes nothing to disk.
-
Extract it
Terminal window $ zpack unpack game.zpak extracted/Extracted 56 filesParent directories are created as needed. Contents are hashed as they stream, so a corrupt entry fails during extraction rather than silently producing a bad file.
-
Confirm the round trip
Terminal window $ diff -r assets/ extracted/No output. The trees are identical.
Repacking is reproducible
Section titled “Repacking is reproducible”Entries are sorted by path before writing, so the same tree always produces the same bytes:
$ zpack pack assets/ a.zpak$ zpack pack assets/ b.zpak$ cmp a.zpak b.zpak # no output: identicalThat holds across machines and platforms too - paths are normalized to /
regardless of the host separator.
Leaving files out
Section titled “Leaving files out”Drop a .zpackignore at the root of the directory you are packing:
# art sources, not shipped*.psd*.blend
# os junk, at any depth.DS_StoreThumbs.dbThe syntax is a subset of .gitignore. The ignore file itself never ends up in
the archive. See .zpackignore for the full pattern rules.
- Give your game compile-checked asset handles with
zpack ids - Read from an archive in Zig instead of shelling out - library overview
- Wire packing into
build.zigso assets rebuild with the project - build integration