Native C core · WebAssembly worker

Binary deltas.
Everywhere RN
runs.

Create and apply compact binary patches across iOS, Android, and React Native Web—with one compatible patch format and typed API.

  • iOS · ObjC++
  • Android · JNI
  • Web · WASM
  • New Architecture
npm i react-native-bs-diff-patch
quick-start.ts
import { diffBytes, patchBytes } from 'react-native-bs-diff-patch';

const delta = await diffBytes(oldBytes, newBytes);
const restored = await patchBytes(oldBytes, delta);
Live / WASM

Try the real implementation

Patch playground

Loading runtime
Worker isolated No payload data leaves this page.
Idle0% 0%
Patch size
Transfer saved
Runtime
Error code
Ready to generate and verify a patch ENDSLEY / BSDIFF43

Same controls, explicit contracts

Progress and cancel on native. AbortSignal on Web.

The playground above executes the browser API. Use the matching path-based job facade in Android and iOS applications.

Android / iOSNative job
const job = startPatch(oldPath, outputPath, patchPath, {
  maxInputBytes: 64 * 1024 * 1024,
  maxOutputBytes: 128 * 1024 * 1024,
});

const off = job.onProgress(({ phase, progress }) =>
  renderProgress(phase, progress)
);

cancelButton.onPress = () => job.cancel();
await job.result.finally(off);
React Native WebWorker + signal
const controller = new AbortController();
const options = {
  signal: controller.signal,
  maxInputBytes: 64 * 1024 * 1024,
  maxOutputBytes: 128 * 1024 * 1024,
};

cancelButton.onclick = () => controller.abort();
const delta = await diffBytes(oldBytes, newBytes, options);
ECANCELLED Native cancelled EINPUT_TOO_LARGE Native input limit EOUTPUT_TOO_LARGE Native output limit EABORTED Web cancelled ERESOURCE Web size limit EUNSUPPORTED Wrong platform API

Under the hood

One format.
Three runtimes.

  1. 01 Typed API

    Paths on native. Binary inputs on Web.

  2. 02 Worker boundary

    Serial native queues or an isolated module Worker.

  3. 03 Shared C core

    The same bsdiff and bzip2 sources everywhere.

  4. 04 Compact delta

    A compatible `ENDSLEY/BSDIFF43` patch.

Designed for integration

Native performance.
Explicit platform contracts.

Expensive work stays off React Native's module queue and the browser main thread. Unsupported API families reject clearly instead of guessing at filesystem behavior.

Read the architecture →
01

New Architecture ready

Version-aware Android packages and generated iOS TurboModule registration.

02

Web Worker by default

WASM work runs outside the page thread; shared calls reuse the initialized runtime and cancellation stays operation-local.

03

Cross-platform patches

Create a patch on one supported runtime and apply it on another.

04

Release-grade checks

Native matrices, device assertions, browser round trips, Metro and package gates.

Measured and compiled

Evidence behind the compatibility claim.

The release gates compile real React Native artifacts, exercise one golden patch across native and Web, fuzz malformed patches, and install the packed npm tarball in clean consumers.

RN 0.73.11 Legacy + New

TurboReactPackage boundary

RN 0.74.7 New Architecture

BaseReactPackage boundary

RN 0.86.0 New Architecture

Current matrix anchor

npm tarball 133 KiB packed

500 KiB unpacked · 58 files

WebAssembly reference

Repeatable, not theoretical.

Apple M3 Pro · Node 26.5.0 · one changed byte per 4 KiB. Every run verifies the restored bytes. Treat these as a development baseline, not a browser performance guarantee.

Benchmark methodology →
Input Diff Patch Delta
1 MiB 158.5 ms 7.7 ms 110 B
10 MiB 4,243.6 ms 57.5 ms 118 B
50 MiB 30,697.5 ms 285.2 ms 203 B

Documentation

From first patch to production boundaries.

Follow platform-specific setup, inspect every API and error code, and understand memory, bundler, and compatibility constraints before you ship.