An erlang term format un/packer written in zig.
Supported runtimes:
- Node.js
- Electron
- Bun
- Deno (no reexported symbols)
import { pack, unpack } from "zerlpack"; // or use require
const buffer = pack(123); // <Buffer 83 61 7b>
const value = unpack(buffer); // 123
// for compatibility with discords erlpack
const value2 = unpack(buffer, { bigintsAsStrings: true });
// optionally you can use zlib to compress the packed data
const buffer2 = pack(123, { compress: true });