# wwl-hash

> node hash utils.

Latest version **1.0.1** (published 2018-04-23) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install wwl-hash
pnpm add wwl-hash
yarn add wwl-hash
bun add wwl-hash
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-04-23 |
| First published | 2017-11-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | wangwl |
| Maintainers | wwl |
| Keywords | hash, md5, wwl, wangwl, wangweilin |

## Links

- npm: https://www.npmjs.com/package/wwl-hash
- Repository: https://gitee.com/w-wl/hash
- Issues: https://gitee.com/w-wl/hash/issues
- npm.io page: https://npm.io/package/wwl-hash

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-04-23
- 1.0.0 — 2017-11-17

## README

# 依赖
node.js 8.x

# 下载
npm install wwl-hash

# 使用
let { hashFile , hashFileSync , hashContent , hashContentSync , stream , algorithms } = require('wwl-hash');

# API

## algorithms
Array\<string\>

支持的hash方法。 例如: 'md5' , 'sha' 等。

## hashFile
function( filePath:string|Buffer|URL, algorithm:string, callback:function(err:Error,data:string) ) :undefined

异步的获取文件hash值。
```javascript
const filePath = 'test.txt';
hash.hashFile(filePath, 'md5', (err, md5) => {
    console.log(md5);
})
```

## hashFileSync
function(filePath, algorithm):string

对应hashFile()的同步方法。返回hash值。

## hashContent
function (content:string, algorithm:string, callback:function(err:Error,data:string)) :undefined

异步的获取传入文本的hash值。

```javascript
hash.hashContent('testContent', 'md5', (err, md5) => {
   console.log(md5);
   //"bae941e0d1cdf42b75d6d0ef6bd7d25a"
})
```

## hashContentSync
function (content, algorithm):string

对应hashContent()的同步方法，返回hash值。

## stream
function (algorithm:string, callback:function(err:Error,data:string)):stream.Writable

该方法返回一个可写流(准确的说，是Hash实例)，计算写入流的数据的hash值。
```javascript
var stream = hash.stream('md5', (err, md5) => {
    console.log(md5);
    //"bae941e0d1cdf42b75d6d0ef6bd7d25a"
});
stream.end('testContent');
```

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