Skip to content

ZIGXFast and light-weight Compression

Fast and smaller compression file format for Zig

ZIGX Logo

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.

Installation

Install the latest stable release (v0.0.1):

bash
zig fetch --save https://github.com/muhammad-fiaz/zigx/archive/refs/tags/v0.0.1.tar.gz

Configure build.zig

zig
const zigx_dep = b.dependency("zigx", .{
    .target = target,
    .optimize = optimize,
});
exe.root_module.addImport("zigx", zigx_dep.module("zigx"));

Quick Start

zig
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,
});

Compression Levels

LevelzstdRatio (lower=better)SpeedUse Case
.ultra22~17-22%SlowestMaximum compression
.best19~19-25%SlowDistribution
.balanced6~21-26%ModerateGeneral purpose
.default3~21-28%BalancedDefault
.fast1~25-33%FastestDevelopment
.none-100%InstantPre-compressed
custom(n)1-22VariesVariesFine-grained control

Function Aliases

ZIGX provides intuitive function aliases:

PrimaryAliasDescription
compress()bundle()Create archives
extract()unbundle()Extract archives
validate()verify()Validate integrity
listFiles()list()List contents
isValidArchive()isValid()Quick validity check

Version Information

  • Library: 0.0.1
  • Format: v1
  • Compression: v1
  • Zig: 0.15.0+

Released under the Apache License 2.0.