Zstandard Compression
Industry-leading zstd compression via Zig bindings - 80%+ space savings on typical data.
Fast and smaller compression file format for Zig

INFO
ZIGX is a new file format specifically designed for Zig distribution packages, but it can also be used as a compressed file format for any other projects.
Install the latest stable release (v0.0.1):
zig fetch --save https://github.com/muhammad-fiaz/zigx/archive/refs/tags/v0.0.1.tar.gzconst zigx_dep = b.dependency("zigx", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("zigx", zigx_dep.module("zigx"));const zigx = @import("zigx");
// Create an archive
const result = try zigx.bundle(.{
.allocator = allocator,
.include = &.{ "src", "build.zig", "README.md" },
.exclude = &.{ "*.tmp", ".git" },
.output_path = "archive.zigx",
.level = .best,
});
// Get archive information
var info = try zigx.getArchiveInfo("archive.zigx", allocator);
defer info.deinit();
std.debug.print("Format: v{d}, Compression: v{d}\n", .{
info.format_version,
info.compression_version,
});| Level | zstd | Ratio (lower=better) | Speed | Use Case |
|---|---|---|---|---|
.ultra | 22 | ~17-22% | Slowest | Maximum compression |
.best | 19 | ~19-25% | Slow | Distribution |
.balanced | 6 | ~21-26% | Moderate | General purpose |
.default | 3 | ~21-28% | Balanced | Default |
.fast | 1 | ~25-33% | Fastest | Development |
.none | - | 100% | Instant | Pre-compressed |
custom(n) | 1-22 | Varies | Varies | Fine-grained control |
ZIGX provides intuitive function aliases:
| Primary | Alias | Description |
|---|---|---|
compress() | bundle() | Create archives |
extract() | unbundle() | Extract archives |
validate() | verify() | Validate integrity |
listFiles() | list() | List contents |
isValidArchive() | isValid() | Quick validity check |