open-source product · Rust + WASM on npm
Diffcorefast Rust/WASM JSON diff engine
tldr
Diffcore is a JSON diff engine written in Rust and compiled to WebAssembly, shipped to npm so JavaScript and TypeScript projects get native-speed diffing with no native addon. It returns real JSON Pointer paths (RFC 6901) and decoded values, emits standard RFC 6902 JSON Patch, and ships applyPatch / revertPatch for state sync, undo/redo, and optimistic UI — plus a React useDiff hook, a CLI, and a streaming engine for multi-GB files.
install
npm install diffcore
import { diff, applyPatch } from "diffcore";
const patch = diff(a, b); // RFC 6902 JSON Patch
const next = applyPatch(a, patch);why it's fast
The engine is Rust compiled with wasm-bindgen, so there is no native addon to build and no separate .wasm file to host. In head-to-head benchmarks it runs 2.3–3.0× faster than fast-json-patch and 4–8× faster than jsondiffpatch, sustaining 390–650 MB/s.
related
Compare vs jsondiffpatch · Other projects: Klinder-OSS · AHTML · whatbroke · Roy UI · all work · about the maker
Built by Dibbayajyoti Roy. Questions or want to use it? Get in touch.