A complete implementation of the Bottom Spec in Zig with both encoding and decoding capabilities.
- Bottom format encoding/decoding
- CLI interface compatible with bottom-rs options
- Static and shared library support
- WebAssembly build target
- C API bindings
- Configurable allocators when targeting zig
- Speed improvements
# Basic build
zig build
# Build with C API with main
zig build -Duse_c=true
# or
zig build run -Duse_c=true -- [bottom zig options]
# Run tests
zig build test-exe # CLI tests
zig build test-lib # Library tests
# Install library only
zig build install-lib
# Build WebAssembly
zig build wasm-shared
# Build benchmarks
zig build benchmark
# Run benchmarks
zig build run-benchmark
As a dependency in your build.zig.zon
via zig fetch. use the standard way of adding a module to your project.
# Encode
bottom-zig
--bottomify "Hello World" # π«πβ¨β¨,,πππβ¨β¨π«πππβ¨β¨,πππβ¨,,πππβ¨β¨β¨,πππβ¨β¨β¨,,πππβ¨,,πππβ¨β¨β¨,πππβ¨β¨β¨,,ππβ¨β¨,πππβ¨β¨β¨πππβ¨β¨β¨,πππβ¨β¨β¨,,πππβ¨,,πππβ¨β¨β¨ππ
# Decode
bottom-zig --regress "π«πβ¨β¨,,πππβ¨β¨π«πππβ¨β¨,πππβ¨,,πππβ¨β¨β¨,πππβ¨β¨β¨,,πππβ¨,,πππβ¨β¨β¨,πππβ¨β¨β¨,,ππβ¨β¨,πππβ¨β¨β¨πππβ¨β¨β¨,πππβ¨β¨β¨,,πππβ¨,,πππβ¨β¨β¨ππ" # Hello World
# Use with files
bottom-zig --bottomify -i input.txt -o output.txt
bottom-zig --regress -i output.txt
See include/bottom.h
for the API definition.
For an example of how to use the C API, see src/example.c
.
Try it in WebAssembly: https://deecellar.github.io/bottom-zig/
Pre-built binaries for Linux, macOS and Windows (x86_64) are available in CI artifacts.
MIT License
- Andrew for making an awesome language
- MasterQ32 for making zig args and being awesome
- der-teufel-programming for saying I should do this
- =3