1.0.0 • Published 4 years ago

bsdiff-rs v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

bsdiff-rs

Using rust to implement an binary diff and patch library based on bsdiff algorithm for NodeJS (Windows, Mac, Linux).

Installation

Install as a dependency for your project:

npm i bsdiff-rs

Usage

const bsdiff = require('bsdiff-rs');
bsdiff.diff(oldFile, newFile, patchFile); // Async
bsdiff.patch(oldfile, newfile, patchfile); // Async

For example:

const path = require('path');

const oldFile = path.join(__dirname, 'resources/react-0.3-stable.zip');
const newFile = path.join(__dirname, 'resources/react-0.4-stable.zip');
const patchFile = path.join(__dirname, 'resources/react.patch');
const generatedFile = path.join(__dirname, 'resources/react-generated.zip');

async function asyncCall() {
    await bsdiff.diff(oldFile, newFile, patchFile);

    await bsdiff.patch(oldFile, generatedFile, patchFile);
}
  
asyncCall();

Copyright 2003-2005 Colin Percival
MIT © Dezeiraud