1.0.2 • Published 8 months ago

@gcas/rsync v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

!Deprecated!

This package is deprecated in favor of @gcas/rdiff.

Native librsync binding for NodeJS.

Initially based on the node-rdiff package.

Platforms supported

  • Linux (x64): YES
  • Windows (x64): YES
  • MacOS: Not yet, planned (should not be hard to add).

Example

The synchronous api (*Sync functions):

var a = "a.txt"; // Contains "hello".
var b = "b.txt"; // Contains "hello world".

// Compute difference from `a` to `b`.
rdiff.signatureSync(a, `${a}.sig`);
rdiff.deltaSync(`${a}.sig`, b, `${a}.delta`);

// Patch `a` so that it becomes equal to `b`.
rdiff.patchSync(a, `${a}.delta`, `${a}.patched`);

The callback async api:

rdiff.signature(a, `${a}.sig`, function (err) {
    rdiff.delta(`${a}.sig`, b, `${a}.delta`, function (err) {
        rdiff.patch(a, `${a}.delta`, `${a}.patched`, function (error) {
            if (error) {
                return console.error(error);
            }

            // File `a.patched` now equals `b`.
        });
    });
});

The promise async api (*Async functions, recommended):

await rdiff.signatureAsync(a, `${a}.sig`);
await rdiff.deltaAsync(`${a}.sig`, b, `${a}.delta`);
await rdiff.patchAsync(a, `${a}.delta`, `${a}.patched`);
// `a` should equal `a.patched`
1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago