lib/rsync/rsync-utils.js
function compareContents(fs, checksumList, callback) {
  var ECHKSUM = "Checksums do not match";

  var paramError = validateParams(fs, checksumList);
  if(paramError) {
    return callback(paramError);
  }

  function compare(checksumNode, callback) {
    var path = checksumNode.path;

    fs.lstat(path, function(err, stat) {
      if(err && err.code !== 'ENOENT') {
        return callback(err);
      }

      // If the types of the nodes on each fs do not match
      // i.e. /a is a file on fs1 and /a is a directory on fs2
      if(!err && checksumNode.type !== stat.type) {
        return callback(ECHKSUM);
      }

      // If the node type is a directory, checksum should not exist
      if(!err && stat.isDirectory()) {
        if(!checksumNode.checksum) {
          return callback();
        }

        callback(ECHKSUM);
      }

      // Checksum comparison for a non-existent path or file/link
      getChecksum(fs, path, function(err, checksum) {
        if(err) {
          return callback(err);
        }

        if(checksum !== checksumNode.checksum) {
          return callback(ECHKSUM);
        }

        callback();
      });
    });
  }

  async.eachSeries(checksumList, compare, function(err) {
    if(err && err !== ECHKSUM) {
      return callback(err);
    }

    callback(null, err !== ECHKSUM);
  });
}
function compareContents(fs, checksumList, callback) {
  var ECHKSUM = "Checksums do not match";

  var paramError = validateParams(fs, checksumList);
  if(paramError) {
    return callback(paramError);
  }

  function compare(checksumNode, callback) {
    var path = checksumNode.path;

    fs.lstat(path, function(err, stat) {
      if(err && err.code !== 'ENOENT') {
        return callback(err);
      }

      // If the types of the nodes on each fs do not match
      // i.e. /a is a file on fs1 and /a is a directory on fs2
      if(!err && checksumNode.type !== stat.type) {
        return callback(ECHKSUM);
      }

      // If the node type is a directory, checksum should not exist
      if(!err && stat.isDirectory()) {
        if(!checksumNode.checksum) {
          return callback();
        }

        callback(ECHKSUM);
      }

      // Checksum comparison for a non-existent path or file/link
      getChecksum(fs, path, function(err, checksum) {
        if(err) {
          return callback(err);
        }

        if(checksum !== checksumNode.checksum) {
          return callback(ECHKSUM);
        }

        callback();
      });
    });
  }

  async.eachSeries(checksumList, compare, function(err) {
    if(err && err !== ECHKSUM) {
      return callback(err);
    }

    callback(null, err !== ECHKSUM);
  });
}
function compareContents ( fs , checksumList , callback ) { var ECHKSUM = "Checksums do not match" ; var paramError = validateParams ( fs , checksumList ) ; if ( paramError ) { return callback ( paramError ) ; } function compare ( checksumNode , callback ) { var path = checksumNode . path ; fs . lstat ( path , function ( err , stat ) { if ( err && err . code !== 'ENOENT' ) { return callback ( err ) ; } // If the types of the nodes on each fs do not match // i.e. /a is a file on fs1 and /a is a directory on fs2 if ( ! err && checksumNode . type !== stat . type ) { return callback ( ECHKSUM ) ; } // If the node type is a directory, checksum should not exist if ( ! err && stat . isDirectory ( ) ) { if ( ! checksumNode . checksum ) { return callback ( ) ; } callback ( ECHKSUM ) ; } // Checksum comparison for a non-existent path or file/link getChecksum ( fs , path , function ( err , checksum ) { if ( err ) { return callback ( err ) ; } if ( checksum !== checksumNode . checksum ) { return callback ( ECHKSUM ) ; } callback ( ) ; } ) ; } ) ; } async . eachSeries ( checksumList , compare , function ( err ) { if ( err && err !== ECHKSUM ) { return callback ( err ) ; } callback ( null , err !== ECHKSUM ) ; } ) ; }
Compare two file systems. This is done by comparing the checksums for a collection of paths in one file system against the checksums for the same those paths in another file system
Compare two file systems . This is done by comparing the checksums for a collection of paths in one file system against the checksums for the same those paths in another file system