sindresorhus/rev-hash

Create a hash for file revving

JavaScript

106

17 commits

updated Sep 18, 2026

See the code

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.

Install

npm install rev-hash

Usage

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.

sindresorhus/rev-hash

Create a hash for file revving

JavaScript

106

17 commits

updated Sep 18, 2026

See the code

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.

Install

npm install rev-hash

Usage

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.

Project health

Overall

3.5/10

Maintained

0/10

Code review

1/10
OpenSSF Scorecard

Latest release

4.1.0 · Nov 1, 2023

Releases this year

0

Significant stargazers

David Clark

537 followers · starred Jun 2018

Arthur Verschaeve

1,657 followers · starred May 2015