# rev-hash

> Create a hash for file revving

Latest version **4.1.0** (published 2023-11-01) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.1.0 |
| Published | 2023-11-01 |
| First published | 2015-05-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 3.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 107 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | hash, crypto, md5, rev, revving, web, buffer, string, file, cache, caching |

## Links

- npm: https://www.npmjs.com/package/rev-hash
- Repository: https://github.com/sindresorhus/rev-hash
- Homepage: https://github.com/sindresorhus/rev-hash#readme
- Issues: https://github.com/sindresorhus/rev-hash/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/rev-hash

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 4.1.0 (latest) — 2023-11-01
- 4.0.0 — 2021-11-10
- 3.0.0 — 2019-04-26
- 2.0.0 — 2017-06-23
- 1.0.0 — 2015-05-22

## README

# rev-hash

> Create a hash for file revving

It will create an `md5` hash from an input buffer or string, and truncate it to 10 characters, which is unique enough for this purpose.

If you think you need a different hash algorithm or a longer hash, [you're wrong](https://blog.risingstack.com/automatic-cache-busting-for-your-css/).

## Install

```sh
npm install rev-hash
```

## Usage

```js
import fs from 'node:fs';
import revisionHash from 'rev-hash';

revisionHash(fs.readFileSync('unicorn.png'));
//=> 'bb9d8fe615'

revisionHash('Lorem ipsum dolor sit amet');
//=> 'fea80f2db0'
```

## API

### revisionHash(input)

#### input

Type: `Uint8Array | string`

The data to create a hash from.

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