https://github.com/endel/node-delta
An efficient delta compression algorithm for Node.js
https://github.com/endel/node-delta
compression delta fossil-scm
Last synced: about 1 year ago
JSON representation
An efficient delta compression algorithm for Node.js
- Host: GitHub
- URL: https://github.com/endel/node-delta
- Owner: endel
- License: other
- Created: 2016-12-27T17:08:59.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-19T12:06:13.000Z (over 8 years ago)
- Last Synced: 2024-08-09T17:14:33.712Z (almost 2 years ago)
- Topics: compression, delta, fossil-scm
- Language: C++
- Size: 27.3 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
node-delta [](http://travis-ci.org/endel/node-delta) [](https://ci.appveyor.com/project/endel/node-delta)
===
An efficient delta compression algorithm for Node.js, written in C. ([see original source code](http://fossil-scm.org/xfer/artifact/e5c5c088b05441b7))
**Requires NodeJS v4 or higher**
Usage
---
```
const fossilDelta = require('node-delta');
```
Creating delta between `origin` and `target` buffer:
```
var origin = new Buffer([1,2,3,4]);
var target = new Buffer([1,2,3,4,5,6]);
var delta = fossilDelta.create(origin, target);
```
Applying the delta:
```
var origin = new Buffer([1,2,3,4]);
var target = fossilDelta.apply(origin, delta);
```
Benchmarks
---
For creating the patch, [node-delta](https://github.com/endel/node-delta/) has the best results. (roughly ~2x speed)
```
(create) node-delta x 313,371 ops/sec ±1.76% (77 runs sampled)
(create) fossil-delta x 238,424 ops/sec ±3.58% (75 runs sampled)
```
For applying the patch, [fossil-delta-js](https://github.com/dchest/fossil-delta-js) still have the best results.
```
(apply) node-delta x 664,472 ops/sec ±5.44% (69 runs sampled)
(apply) fossil-delta x 860,541 ops/sec ±1.57% (84 runs sampled)
```
References
---
- [Fossil Delta Format](http://fossil-scm.org/xfer/doc/trunk/www/delta_format.wiki)
- [Pure JavaScript port](https://github.com/dchest/fossil-delta-js)
- [C# port](https://github.com/endel/FossilDelta)
License
---
MIT