# hash_file

> A simple utility for getting a hash of a file

Latest version **0.1.1** (published 2013-10-27) · 0 weekly downloads

## Install

```sh
npm install hash_file
pnpm add hash_file
yarn add hash_file
bun add hash_file
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2013-10-27 |
| First published | 2011-11-28 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.6.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Tim Oxley |
| Maintainers | timoxley |
| Keywords | hash, md5, sha1, crypto, file |

## Links

- npm: https://www.npmjs.com/package/hash_file
- Repository: https://github.com/timoxley/hash_file
- Issues: https://github.com/timoxley/hash_file/issues
- npm.io page: https://npm.io/package/hash_file

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2013-10-27
- 0.1.0 — 2013-07-19
- 0.0.8 — 2012-03-08
- 0.0.7 — 2012-02-03
- 0.0.6 — 2011-11-28
- 0.0.5 — 2011-11-28

## README

[![build status](https://secure.travis-ci.org/timoxley/hash_file.png)](http://travis-ci.org/timoxley/hash_file)
# Hash File

A simple utility for getting the hash of a file or Buffer.

### Supported Hash Types

* MD4
* MD5
* SHA1
* SHA256

## Installation
```
npm install hash_file
```

## Usage 

```js
var hash_file = require('hash_file')

// get md5
hash_file('./README.md', 'md5', function(err, hash) {
  console.log('md5:', hash)
})

// get sha1 
hash_file('./README.md', 'sha1', function(err, hash) {
  console.log('sha1:', hash)
})

// get sha256 
hash_file('./README.md', 'sha256', function(err, hash) {
  console.log('sha256:', hash)
})

// on a Buffer
var buf = crypto.randomBytes(1024)

hash_file(buf, 'md5', function (err, hash) {
  console.log('md5:', hash)
})

// or simply:
console.log('md5:', hash_file(buf, 'md5'))
```

## Running the tests

```sh
> npm install
> npm test
```

## Credits

Code originally adapted from Gregor Schwab greg@synaptic-labs.net ([dotmaster](http://github.com/dotmaster))

## License 

(The MIT License)

Copyright (c) 2011 Gregor Schwab &lt;dev@synaptic-labs.net&gt;

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---
_Source: https://npm.io/package/hash_file · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
