Skip to content

Releases: reactnativecn/node-hdiffpatch

v2.4.0

Choose a tag to compare

@sunnylqm sunnylqm released this 02 Aug 15:21
bd6516f

Safety hardening

  • Transactional file outputs: all file-based diff/patch APIs (and the hdp CLI) write to an exclusively-created temp file and atomically rename it over the destination only after verification succeeds. Failures remove the temp file and never touch an existing destination. In-place operation (output path == input path, including hard-link/symlink aliases) is now safe and supported.
  • Patch resource limits: patch(), patchStream(), patchSingleStream() accept { maxOutputBytes, maxWorkingMemoryBytes } and enforce finite defaults (2 GiB in-memory / 16 GiB file output, 256 MiB working memory). Corrupt or malicious patch headers are rejected before any allocation or output-file creation.
  • Async input ownership: async diff()/patch() copy their buffer inputs before queueing; mutating, transferring, or detaching the source buffers after the call can no longer corrupt results.
  • DataView inputs are now accepted; windowSize values above Number.MAX_SAFE_INTEGER are rejected (previously undefined behavior).
  • Prebuild load errors are preserved as err.cause when the fallback loader also fails.

CI / packaging

  • Per-platform smoke test of the packed npm tarball (loads from prebuilds/ only).
  • Linux prebuilds are rejected if they require glibc symbols above 2.34 (the baseline since v2.3.0; compatible with Ubuntu 22.04 / Debian 12 / RHEL 9).
  • Full test suite now also runs on Node 14.17 (the declared engines floor).
  • README platform list corrected to the actually published targets: darwin-arm64, linux-x64, linux-arm64.

Dependencies

Updated to latest: node-gyp-build 4.8.4, node-addon-api 8.9.1, node-gyp 13.0.1, prebuildify 6.0.1, @types/bun 1.3.14.

v2.3.0

Choose a tag to compare

@sunnylqm sunnylqm released this 13 Jul 11:44
aa5dfa5

Add optional, bounded LZMA2 match-finder multithreading with deterministic byte-identical output. The default remains one thread; compression level 9 and the 8 MiB dictionary are unchanged. Published prebuilds target Linux x64/arm64 and macOS arm64.

v2.2.2

Choose a tag to compare

@sunnylqm sunnylqm released this 13 Jul 11:02
15b2df5

Expose explicit capabilities indicating that native stream diff functions verify generated patches before returning. Compression settings and patch format are unchanged.

v2.2.1

Choose a tag to compare

@sunnylqm sunnylqm released this 08 Jul 07:55
9b77951

Fixes

  • Compatibility: single-format (HDIFFSF20) diffs that store the payload raw (compression would expand it) no longer carry a stale lzma2 compressType label. Old decoders (HDiffPatch ~4.x, including react-native-update clients in the field) decide whether to decompress from the label alone and failed with hpatch error -4 on such diffs — typically tiny diffs between near-identical bundles. Output is now byte-compatible with 1.x for this case. Applies to diff(), diffWindow(), and diffSingleStream(); diffStream (HDIFF13) was never affected.

Upgrade urgency: high if you generate update diffs with 2.0.3–2.2.0 — a small enough diff generated by those versions fails to apply on all deployed clients that predate the reader-side guard.

v2.2.0

Choose a tag to compare

@sunnylqm sunnylqm released this 08 Jul 07:15
4f42a80

Added

  • diffWindow(oldPath, newPath, outDiffPath[, windowSize][, cb]): optional windowSize (bytes, default 2MB) controls the sliding window over old data. Larger windows catch longer-distance content moves at roughly linear additional memory — useful when a bundle's sections move further than 2MB between versions.

v2.1.0

Choose a tag to compare

@sunnylqm sunnylqm released this 08 Jul 06:42
ad1dc1c

Added

  • diffWindow(oldPath, newPath, outDiffPath[, cb]): window/fast-match single-format generation — big covers from streaming block matching + suffix-string refinement inside a 2MB sliding window over old data. Match quality is close to in-memory diff() while memory stays at the streaming tier.
  • Output is standard HDIFFSF20: applies via patch(), patchSingleStream(), and all existing single-format apply sides (verified byte-exact against the legacy v3.1.1 client patch core). No consumer changes needed.

Benchmarks (vs diffSingleStream, block=64)

pair diffSingleStream diffWindow in-memory diff
218KB Hermes HBC 19,034 B 4,920 B 4,929 B
100MB similar 2,258 B 455 B

Peak RSS on the 100MB pair: ~27MB for both streaming modes.

v2.0.3

Choose a tag to compare

@sunnylqm sunnylqm released this 08 Jul 03:58
b6178fd

修复 Windows x64 prebuild 链接:编入 lzma CpuArch.c。功能同 v2.0.0(见其 release notes)。

v2.0.2

Choose a tag to compare

@sunnylqm sunnylqm released this 08 Jul 03:55
4d0f42f

修复 Windows prebuild 链接:补齐 v5 的 window_diff 与 HPatchLite 源文件。功能同 v2.0.0(见其 release notes)。

v2.0.1

Choose a tag to compare

@sunnylqm sunnylqm released this 08 Jul 03:50
5a0ee02

修复 Windows prebuild:HDiffPatch v5 中 divsufsort 源文件为 .cpp。其余同 v2.0.0(见其 release notes)。

v2.0.0

Choose a tag to compare

@sunnylqm sunnylqm released this 08 Jul 03:45
80f2d9c

Breaking Changes

  • Removed diffWithCovers. 该实验性 API 无消费方;移除后 HDiffPatch 子模块可直接跟踪纯上游(v5.0.1),不再携带自有补丁。

What's Changed

  • Vendored HDiffPatch v3.1.1 → v5.0.1,lzma SDK → v26.02。同输入产物逐字节同级、diff 速度持平;patch 双向兼容已验证(老库产物 ↔ 新库应用)。
  • 新增 diffSingleStream(oldPath, newPath, outDiffPath[, cb]):流式块匹配生成 single 格式(与 diff() 同格式)——生成端内存 O(匹配块),实测 100MB 输入仅 ~27MB RSS 增量;产物经旧版(v3.1.1)客户端 patch 内核逐字节验证可直接应用,存量客户端零升级即可受益
  • 关闭 v5 默认的 diff 进度打印,保持服务端 worker 日志干净。

Full Changelog: v1.3.0...v2.0.0