A Zig library and small command line tool for compressing and decompressing things with the Uxn LZ Format (ULZ). This is a port of a C implementation that's a part of uxn-utils by Hundred Rabbits.
const ulz = @import("ulz");
const decoded = try ulz.decode(allocator, @embedFile("file.ulz"));
defer allocator.free(decoded);
const encoded = try ulz.encode(allocator, "compress meeeeee");
defer allocator.free(encoded);
To import ulz in your project, run the following command:
zig fetch --save git+https://github.com/coat/ulzig
Then set add the dependency in your build.zig
:
const ulz = b.dependency("ulzig", .{
.target = target,
.optimize = optimize,
})
mod.root_module.addImport("ulz", ulz.module("ulzig"));
Compress the file foo
into foo.ulz
:
ulz foo
Decompress foo.ulz
into foo
:
ulz -d foo.ulz
Download the latest release from GitHub and place the binary in your PATH.
nix run github:coat/ulzig
Original implementation in C that this code was based on.