sha
Check and get file hashes
Last updated 10 years ago by forbeslindesay .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install sha 
SYNC missed versions from official npm registry.

sha

Check and get file hashes (using any algorithm)

Build Status Dependency Status NPM version

Installation

$ npm install sha

API

check(fileName, expected, [options,] cb) / checkSync(filename, expected, [options])

Asynchronously check that fileName has a "hash" of expected. The callback will be called with either null or an error (indicating that they did not match).

Options:

  • algorithm: defaults to sha1 and can be any of the algorithms supported by crypto.createHash

get(fileName, [options,] cb) / getSync(filename, [options])

Asynchronously get the "hash" of fileName. The callback will be called with an optional error object and the (lower cased) hex digest of the hash.

Options:

  • algorithm: defaults to sha1 and can be any of the algorithms supported by crypto.createHash

stream(expected, [options])

Check the hash of a stream without ever buffering it. This is a pass through stream so you can do things like:

fs.createReadStream('src')
  .pipe(sha.stream('expected'))
  .pipe(fs.createWriteStream('dest'))

dest will be a complete copy of src and an error will be emitted if the hash did not match 'expected'.

Options:

  • algorithm: defaults to sha1 and can be any of the algorithms supported by crypto.createHash

License

You may use this software under the BSD or MIT. Take your pick. If you want me to release it under another license, open a pull request.

Current Tags

  • 3.0.0                                ...           latest (6 years ago)

12 Versions

  • 3.0.0                                ...           6 years ago
  • 2.0.1                                ...           9 years ago
  • 2.0.0                                ...           9 years ago
  • 1.3.0                                ...           10 years ago
  • 1.2.4                                ...           11 years ago
  • 1.2.3                                ...           11 years ago
  • 1.2.2                                ...           11 years ago
  • 1.2.1                                ...           12 years ago
  • 1.2.0                                ...           12 years ago
  • 1.1.0                                ...           12 years ago
  • 1.0.1                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
Downloads
Today 0
This Week 0
This Month 32
Last Day 0
Last Week 32
Last Month 0
Dependencies (2)
Dev Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |