Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

rdiff

0.0.5 • Public • Published

rdiff simple binding in node.js

http://linux.die.net/man/1/rdiff

pre

install librsync ~0.9.7 or >=1.0.0.

example

the sync api

// a new file contains "hello"
var a = "a.txt";
 
// a file contains "hello world"
var b = "b.txt";
 
// `a` wants to be `b`
 
rdiff.signatureSync (a, a + ".sig");
rdiff.deltaSync (+ ".sig", b, a + ".delta");
 
// the `a.patched` contains "hello world"
rdiff.patchSync (a, a + ".delta", a + ".patched");

do the same with async api

rdiff.signature(a, a + ".sig", function (err){
  rdiff.delta(+ ".sig", b, a + ".delta", function(err){
    rdiff.patch (a, a + ".delta", a + ".patched", function(err) {
      // yeah! contents of `a` should equal contents of `a.patched`
    });
  })
});

warning

it doesn't do file existence checking yet.

license

MIT

Install

npm i rdiff

DownloadsWeekly Downloads

1

Version

0.0.5

License

MIT

Last publish

Collaborators

  • avatar