]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/sha/README.md
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / sha / README.md
1 # sha
2
3 Check and get file hashes (using any algorithm)
4
5 [![Build Status](https://img.shields.io/travis/ForbesLindesay/sha/master.svg)](https://travis-ci.org/ForbesLindesay/sha)
6 [![Dependency Status](https://img.shields.io/gemnasium/ForbesLindesay/sha.svg)](https://gemnasium.com/ForbesLindesay/sha)
7 [![NPM version](https://img.shields.io/npm/v/sha.svg)](http://badge.fury.io/js/sha)
8
9 ## Installation
10
11     $ npm install sha
12
13 ## API
14
15 ### check(fileName, expected, [options,] cb) / checkSync(filename, expected, [options])
16
17 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).
18
19 Options:
20
21 - algorithm: defaults to `sha1` and can be any of the algorithms supported by `crypto.createHash`
22
23 ### get(fileName, [options,] cb) / getSync(filename, [options])
24
25 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.
26
27 Options:
28
29 - algorithm: defaults to `sha1` and can be any of the algorithms supported by `crypto.createHash`
30
31 ### stream(expected, [options])
32
33 Check the hash of a stream without ever buffering it.  This is a pass through stream so you can do things like:
34
35 ```js
36 fs.createReadStream('src')
37   .pipe(sha.stream('expected'))
38   .pipe(fs.createWriteStream('dest'))
39 ```
40
41 `dest` will be a complete copy of `src` and an error will be emitted if the hash did not match `'expected'`.
42
43 Options:
44
45 - algorithm: defaults to `sha1` and can be any of the algorithms supported by `crypto.createHash`
46
47 ## License
48
49 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.