Giter Club home page Giter Club logo

node-filecompare's Introduction

Build Status Project Git Url

filecompare

Asynchronous file compare. Now using native Promises and native BufferTools (alloc and Buffer comparisons)

install

npm install --save filecompare

test

npm test

Example

var fc = require('filecompare');
var cb = function(isEqual) {
  console.log("equal? :" + isEqual);
}
fc(path1,path1,cb);

command line usage

npm install -g filecompare

filecompare a.txt b.txt

Features

  • perfect for high stress systems
  • works with binary data
  • perfect for comparing very large files

Advanced usage

Specify read size and buffer size.

var fc = require('filecompare');
var cb = function(isEqual) {
  console.log("equal? :" + isEqual);
}
const readSize = 4096;
const bufferSize = 8192;
fc(path1,path1,cb,readSize, bufferSize);

Why is this useful?

Bytes are read into a small buffer, then compared.

Each step is independently asynchronous yet only steps forward after confirming buffers are identical.

This means if there is an unforseen process spike from some other processes, the file compare will exscuse itself until CPU load becomes more available. This means you can compare arbitrarily sized multi-gigabyte files all the time without worry about locking up the computer.

LICENSE

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.