🎯 Highlights
- WebAssembly bindings: Universal ~890KB package for browsers, Node.js, Bun, Deno, and edge runtimes
- C/C++ bindings: FFI wrapper enabling Go and other language integrations
- npm package reorganization:
xpatch-rsis now WASM (recommended),xpatch-rs-nativefor maximum performance - ~10µs encode, ~1µs decode for small data in WASM
- 99.88% compression on 10KB files with single-byte changes
Installation
WebAssembly (Browser + Node.js) - Recommended:
npm install xpatch-rsimport init, { encode, decode, get_tag } from "xpatch-rs";
await init();
const delta = encode(0, base, newData, true);
const reconstructed = decode(base, delta);Node.js Native (Maximum Performance):
npm install xpatch-rs-nativePython:
pip install xpatch-rsRust:
[dependencies]
xpatch = "0.4.2"C/C++:
# Build with axogen
axogen run build c
# Or manually
cd crates/xpatch-c && cargo build --releaseNew Bindings
WebAssembly (xpatch-rs on npm)
- Works in browsers, Node.js, Bun, Deno, Cloudflare Workers
- Single ~890KB universal package
- Requires
await init()before use - Full TypeScript definitions included
C/C++ (crates/xpatch-c/)
- FFI wrapper with 6 core functions
- Auto-generated header via cbindgen
- Distribution package with library, header, and docs
- Enables Go and other language bindings
Package Organization
| Package | Registry | Use Case |
|---|---|---|
xpatch-rs
| npm | WASM - browsers & universal Node.js |
xpatch-rs-native
| npm | Native Node.js for max performance |
xpatch-rs
| PyPI | Python bindings |
xpatch
| crates.io | Rust library |
Performance
| Binding | Encode (small) | Decode (small) | Compression |
|---|---|---|---|
| WASM | ~10µs | ~1µs | 99.88% |
| Python | ~7µs | <0.1µs | 99.89% |
| Node Native | ~10-30% faster than WASM | - | 99.88% |
Full Changelog: https://github.com/ImGajeed76/xpatch/blob/master/CHANGELOG.md
GitHub Changelog: v0.3.1...v0.4.2