lib/package.js
function(file, cb) {
  var error,
      hash   = createHash('sha1'),
      stream = fs.ReadStream(file);

  stream.on('data', function(chunk) {
    hash.update(chunk);
  });

  stream.on('error', function(e) {
    if (!error) cb(e);
    error = e;
  })

  stream.on('end', function() {
    if (!error) cb(null, hash.digest('hex'));
  });
}
function(file, cb) {
  var error,
      hash   = createHash('sha1'),
      stream = fs.ReadStream(file);

  stream.on('data', function(chunk) {
    hash.update(chunk);
  });

  stream.on('error', function(e) {
    if (!error) cb(e);
    error = e;
  })

  stream.on('end', function() {
    if (!error) cb(null, hash.digest('hex'));
  });
}
function ( file , cb ) { var error , hash = createHash ( 'sha1' ) , stream = fs . ReadStream ( file ) ; stream . on ( 'data' , function ( chunk ) { hash . update ( chunk ) ; } ) ; stream . on ( 'error' , function ( e ) { if ( ! error ) cb ( e ) ; error = e ; } ) stream . on ( 'end' , function ( ) { if ( ! error ) cb ( null , hash . digest ( 'hex' ) ) ; } ) ; }
returns sha1 checksum for file
returns sha1 checksum for file