Skip to content

Library API

All language bindings wrap the same core Rust library and expose similar shapes. Signatures below are paraphrased for readability — see each binding’s generated reference for authoritative types.

from bindu import Compressor, Reader, Schema, Dict
# Compression
with Compressor(
schema="jsonl-v1",
dict="app-logs.bindud",
level=6,
) as c:
c.compress_file("input.jsonl", "output.bindu")
# Streaming reads (no decompression to disk)
with Reader("output.bindu") as r:
for record in r.stream(
columns=["ts", "service", "msg"],
where="level == 'error'",
):
print(record)
# Schemas
schema = Schema.generate(["sample1.jsonl", "sample2.jsonl"])
schema.save("app-logs.bindus")

Install: pip install bindu.

import { compress, Reader, Schema } from "@bindu-labs/core";
await compress({
input: "input.jsonl",
output: "output.bindu",
schema: "jsonl-v1",
dict: "app-logs.bindud",
level: 6,
});
const reader = await Reader.open("output.bindu");
for await (const record of reader.stream({
columns: ["ts", "service", "msg"],
where: "level == 'error'",
})) {
console.log(record);
}

Install: npm install @bindu-labs/core.

use bindu::{Compressor, Reader, Schema};
let schema = Schema::load("app-logs.bindus")?;
let mut c = Compressor::builder()
.schema(schema)
.dict_path("app-logs.bindud")
.level(6)
.build()?;
c.compress_file("input.jsonl", "output.bindu")?;
let reader = Reader::open("output.bindu")?;
for record in reader.stream().columns(&["ts", "service", "msg"])
.where_expr("level == 'error'")
.iter()?
{
let r = record?;
println!("{r:?}");
}

Install: cargo add bindu.

import "github.com/bindu-labs/bindu-go"
c, _ := bindu.NewCompressor(bindu.Options{
Schema: "jsonl-v1",
Dict: "app-logs.bindud",
Level: 6,
})
_ = c.CompressFile("input.jsonl", "output.bindu")
r, _ := bindu.Open("output.bindu")
it, _ := r.Stream(bindu.StreamOptions{
Columns: []string{"ts", "service", "msg"},
Where: `level == "error"`,
})
for it.Next() {
fmt.Println(it.Record())
}

Install: go get github.com/bindu-labs/bindu-go.

  • Compressors and readers are Send + Sync (Rust) / thread-safe (other bindings), but create one per worker for best throughput.
  • Reader uses memory-mapped I/O by default. For streaming over network filesystems, pass mmap: false.
  • Default heap usage per compressor is ~64 MB; tune with memory_budget option.

All bindings surface a structured error with:

  • code — matches exit codes
  • kind"schema" | "io" | "integrity" | ...
  • message — human-readable
  • cause — lower-level cause (if any)