New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

bsdiff-node

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bsdiff-node

An binary diff and patch library based on bsdiff algorithm for NodeJS (Windows, Mac, Linux).

latest
Source
npmnpm
Version
2.5.0
Version published
Weekly downloads
927
23.77%
Maintainers
1
Weekly downloads
 
Created
Source

CI NpmLicense

🟡 Project status: maintenance mode

  • Project is no longer in active development
  • Only bug-related issues are accepted
  • Only bug-related pull requests are accepted
  • New features are unlikely to be added
  • Project status may eventually transition to "discontinued" or back to "active"

bsdiff-node

An binary diff and patch library based on bsdiff algorithm for NodeJS (Windows, Mac, Linux)


If you find this package useful, please don't forget to star ⭐️ the repo, as this will help to promote the project.

Installation

Install as a dependency for your project (need python 3.x):

npm i bsdiff-node

Usage

const bsdiff = require('bsdiff-node');
bsdiff.diff(oldFile, newFile, patchFile, function(result, err) {}); // Async
bsdiff.patch(oldfile, newfile, patchfile, function(result, err) {}); // Async

bsdiff.diffSync(oldFile, newFile, patchFile); // Sync
bsdiff.patchSync(oldfile, newfile, patchfile); // Sync

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, function (result) {
        console.log('diff:' + String(result).padStart(4) + '%');
    });

    await bsdiff.patch(oldFile, generatedFile, patchFile, function (result) {
        console.log('patch:' + String(result).padStart(4) + '%');
    });
}
  
asyncCall();

License

The original algorithm and implementation was developed by Colin Percival. The algorithm is detailed in his paper, Naïve Differences of Executable Code. For more information, visit his website at http://www.daemonology.net/bsdiff/.

Copyright 2003-2005 Colin Percival
MIT © Dezeiraud

Keywords

bsdiff

FAQs

Package last updated on 14 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts