sha

WebJar for sha

License

License

BSD 2-Clause
MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

sha
Last Version

Last Version

3.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

sha
WebJar for sha
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/ForbesLindesay/sha

Download sha

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/sha/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>sha</artifactId>
    <version>3.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/sha/
implementation 'org.webjars.npm:sha:3.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/sha/
implementation ("org.webjars.npm:sha:3.0.0")
'org.webjars.npm:sha:jar:3.0.0'
<dependency org="org.webjars.npm" name="sha" rev="3.0.0">
  <artifact name="sha" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='sha', version='3.0.0')
)
libraryDependencies += "org.webjars.npm" % "sha" % "3.0.0"
[org.webjars.npm/sha "3.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : graceful-fs jar [4.1.2,5)

Project Modules

There are no modules declared in this project.

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.

Versions

Version
3.0.0
2.0.1