This is a Rust + Node.js native addon library (@bsdiff-rust/node) using NAPI-RS. It implements bsdiff/bspatch binary diff/patch algorithms. There are no external services (no databases, no HTTP servers, no Docker required for local dev).
All standard dev commands are in package.json scripts — see README.md for details. Quick reference:
| Task | Command |
|---|---|
| Install deps | pnpm install |
| Build native addon (release) | pnpm build |
| Build native addon (debug) | pnpm build:debug |
| Run tests | pnpm test |
| Lint | pnpm lint |
| Format | pnpm format |
| Benchmark | pnpm run bench |
- Rust version: The napi v3 dependencies require Rust >= 1.88. The pre-installed Rust toolchain may be too old. Run
rustup default stableafterrustup update stableifpnpm buildfails withedition2024or version errors. - Test resources: Tests require two zip files that are NOT checked into git. They must be downloaded before running
pnpm test:curl -L -o test/resources/react-18.1.0.zip "https://github.com/facebook/react/archive/refs/tags/v18.1.0.zip" curl -L -o test/resources/react-19.1.0.zip "https://github.com/facebook/react/archive/refs/tags/v19.1.0.zip" cargo fmt --checkwill report diffs because the Rust source uses 4-space indentation whilerustfmt.tomlspecifiestab_spaces = 2. This is a pre-existing inconsistency in the repo.- The native
.nodebinary is generated in the workspace root (e.g.,node.linux-x64-gnu.node) and is loaded byindex.js. You must runpnpm buildbefore tests or any usage. lint-staged+huskyare configured inpackage.jsonbut the.husky/directory is absent, so git hooks are not active.