@suaveplan/bitpacker-delta - Bitpacker delta plugin
Summary
Delta encoding utilities for efficient repeated state transmission. Detects changes between successive values and encodes differences rather than full values.
Documentation tree
- delta-manager — (no submodules)
- delta-manager — (no submodules)
- delta-state — (no submodules)
- delta-state — (no submodules)
- index — Path:
bitpacker-delta/src/index.tsExport: See source for details. - string-diff — Path:
src/string-diff.tsExport:calculateStringDiff,applyStringDiff,calculateDiffSavings, `shouldUse… - xor-encoder — Path:
src/xor-encoder.tsExport:calculateXorDelta,applyXorDelta,calculateDeltaBitSize, `isXorEfficie…
- string-diff — Path:
src/string-diff.tsExport:calculateStringDiff,applyStringDiff,calculateDiffSavings, `shouldUse… - xor-encoder — Path:
src/xor-encoder.tsExport:calculateXorDelta,applyXorDelta,calculateDeltaBitSize, `isXorEfficie… - delta-manager — (no submodules)- delta-state — (no submodules)- delta-state — (no submodules)- index — Path:
bitpacker-delta/src/index.tsExport: See source for details. - string-diff — Path:
src/string-diff.tsExport:calculateStringDiff,applyStringDiff,calculateDiffSavings, `shouldUse… - xor-encoder — Path:
src/xor-encoder.tsExport:calculateXorDelta,applyXorDelta,calculateDeltaBitSize, `isXorEfficie… - delta-manager — (no submodules)- delta-state — (no submodules)- delta-state — (no submodules)- index — Path:
bitpacker-delta/src/index.tsExport: See source for details. - string-diff — Path:
src/string-diff.tsExport:calculateStringDiff,applyStringDiff,calculateDiffSavings, `shouldUse… - xor-encoder — Path:
src/xor-encoder.tsExport:calculateXorDelta,applyXorDelta,calculateDeltaBitSize, `isXorEfficie… - delta-manager — (no submodules)- delta-state — (no submodules) - delta-state — (no submodules)- index — Path:
bitpacker-delta/src/index.tsExport: See source for details. - string-diff — Path:
src/string-diff.tsExport:calculateStringDiff,applyStringDiff,calculateDiffSavings, `shouldUse… - xor-encoder — Path:
src/xor-encoder.tsExport:calculateXorDelta,applyXorDelta,calculateDeltaBitSize, `isXorEfficie…
Install
bun add @suaveplan/bitpacker-delta
Usage
import { DeltaManager, calculateStringDiff, applyStringDiff, numberXor } from "@suaveplan/bitpacker-delta";
// Change detection
const dm = new DeltaManager();
dm.detectChanges({ x: 1, y: 2 }); // returns { x: 1, y: 2 }
dm.detectChanges({ x: 1, y: 2 }); // returns undefined (no change)
dm.detectChanges({ x: 1, y: 3 }); // returns { x: 1, y: 3 }
// String diff
const diff = calculateStringDiff("hello world", "hello there");
// { prefixLen: 6, suffixLen: 0, middleLen: 5, middle: "there" }
const reconstructed = applyStringDiff("hello world", diff);
// "hello there"
// Numeric XOR delta
const delta = numberXor(3.14159, 2.71828);
Modules
src/index.ts—DeltaManager, change detection APIsrc/xor-encoder.ts— XOR-based numeric delta encodingsrc/string-diff.ts— Common prefix/suffix string diff encoding