Skip to content

A pure TypeScript implementation of the Rsync algorithm

License

Notifications You must be signed in to change notification settings

dldc-packages/rsync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

♻️ Rsync

A pure TypeScript implementation of the rsync algorithm

Warning

There is an issue wit the implementation of the algorithm when diffing 2 empty files. Unfortunately, I don't have the time to fix it right now as I'm no longer using this package. Instead, I'm using @dldc/librsync which is a WASM port of a Rust implementation.

Installation

npm install @dldc/rsync

Usage

import { apply, diff, prepare } from "@dldc/rsync";

const checksum = prepare(destFile); // you can specify block size as second argument (default: 1024)
// send checksum to source
const patches = diff(sourceFile, checksum);
// send patches to dest
const syncedFile = apply(destFile, patches);

Performance

This package was not designed to be fast. Since it's implemented fully in TypeScript, it's not as fast as the C implementation of rsync. I tried to use the best practices to make it less slow but I did not benchmark it 🤷.

Dependencies 🪶

This package has a single dependency @dldc/erreur to define custom errors.

About

A pure TypeScript implementation of the Rsync algorithm

Resources

License

Stars

Watchers

Forks

Packages

No packages published