npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@better-update/bsdiff

v0.2.8

Published

First-party bsdiff patch **producer** for better-update, written in Rust and exposed via napi-rs (N-API v3). Wraps the [`qbsdiff`](https://crates.io/crates/qbsdiff) crate (v1.4.4) to emit classic bsdiff-4.x (`BSDIFF40`) patches: an 8-byte magic, a 32-byte

Readme

@better-update/bsdiff

First-party bsdiff patch producer for better-update, written in Rust and exposed via napi-rs (N-API v3). Wraps the qbsdiff crate (v1.4.4) to emit classic bsdiff-4.x (BSDIFF40) patches: an 8-byte magic, a 32-byte header, and three bzip2 streams (control/diff/extra) — exactly the format expo-updates 56's vendored bspatch.c applies on device.

It replaces [email protected], a legacy NAN/V8 addon that segfaults under bun (exit 133 — JSC is not V8). N-API is ABI-stable and loads under bun (same loader mechanism as @napi-rs/keyring, already used in packages/credentials-crypto).

API

// Native binding (auto-generated index.js / index.d.ts from `napi build`):
diffSync(oldPath: string, newPath: string, outPath: string): void
diffBuffer(old: Buffer, new: Buffer): Buffer

// Pure helper shim:
import { BSDIFF40_MAGIC, hasBsdiff40Magic } from "@better-update/bsdiff/magic";

diffSync mirrors the signature the CLI's BsdiffService already drives, so the binding source can be swapped without touching the Effect port.

Build

bun run build              # napi build --platform --release → host .node + index.js/.d.ts
bun run test               # vitest unit tests for the pure shim (NO C compiled)
bun run test:conformance   # the SHIP GATE — see below (needs build + libbz2 + C compiler)

The native artifacts (*.node, index.js, index.d.ts, target/) are git-ignored and rebuilt by napi build.

Cross-platform prebuilts (CI — FOLLOWUP)

Only the host (darwin-arm64) binary is built locally. The other seven targets in package.json napi.targets (darwin-x64, linux x64/arm64 gnu+musl, win32 x64/arm64 msvc) require CI runners / cross-compile and are produced by .github/workflows/build-bsdiff.yml (scaffolded, not yet wired into release).

The per-platform binaries publish as the optionalDependencies split packages (scaffolded under npm/<platform>/); the main package's auto-generated loader picks the right one at runtime. To ship: flip this package to private: false, run the publish job (napi prepublish -t npm), then publish the main package.

Conformance gate — the bsdiff ship-gate

qbsdiff is format-compatible with classic bsdiff-4.x but a different implementation than the bsdiff-node it replaces. "Same format" is a claim; byte-identical reconstruction is only proven by feeding a real patch through the real on-device patcher. conformance/ is that proof, codified as a reproducible harness — and it is the gate that must be green before shipping the producer.

bun run build              # first: produce the host .node addon
bun run test:conformance   # == node conformance/run-conformance.mjs

conformance/run-conformance.mjs (exit 0 = PASS, non-zero = do-not-ship):

  1. asserts conformance/fixtures/bspatch.c matches the pinned expo SDK-56 sha256 17982b286d43583aa850c022a87db83e63b3d256b2c7822cf58d960674581d8b (the unmodified on-device patcher — tampering fails the gate);
  2. compiles it + the thin wrapper.c main() — macOS: /usr/bin/clang -I/opt/homebrew/opt/bzip2/include -L/opt/homebrew/opt/bzip2/lib -lbz2 (keg-only brew install bzip2); Linux: cc … -lbz2 (apt-get install -y libbz2-dev);
  3. produces a BSDIFF40 patch via this package's diffSync;
  4. applies it with the compiled bspatch and asserts SHA-256(out) == SHA-256(new);
  5. negative control A — a bad-magic patch is rejected;
  6. negative control B — applying against the wrong base diverges from new.

Test vectors are representative blobs, not a real hermesc .hbc (no hermesc in this env). bspatch treats inputs as opaque bytes, so the format-compat proof is payload-shape-independent; see conformance/fixtures/README.md for the caveat and how to upgrade to a production .hbc fixture.

Why it is NOT in bun run test

The gate compiles C against libbz2. The unit run (bun run test) must never compile C, so the harness is excluded in vitest.config.ts (include: ["src/**/*.test.ts"], exclude: ["conformance/**", …]) and lives in the dedicated test:conformance script + the .github/workflows/conformance-bsdiff.yml CI job (ubuntu + macOS), which builds the addon, installs libbz2, and runs the gate. A non-zero exit blocks the merge/ship.