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);
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
import { diffBytes, patchBytes } from 'react-native-bs-diff-patch';
const delta = await diffBytes(oldBytes, newBytes);
const restored = await patchBytes(oldBytes, delta);
Try the real implementation
Patch playground
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.
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.
-
01
Typed API
Paths on native. Binary inputs on Web.
-
02
Worker boundary
Serial native queues or an isolated module Worker.
-
03
Shared C core
The same bsdiff and bzip2 sources everywhere.
-
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 →New Architecture ready
Version-aware Android packages and generated iOS TurboModule registration.
Web Worker by default
WASM work runs outside the page thread; shared calls reuse the initialized runtime and cancellation stays operation-local.
Cross-platform patches
Create a patch on one supported runtime and apply it on another.
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.
TurboReactPackage boundary
BaseReactPackage boundary
Current matrix anchor
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.