rev-hash
v4.1.0 hash crypto md5 rev revving web buffer string file and 3 more...
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.
npm i rev-hash
Metadata
- MIT
- ^12.20.0 || ^14.13.1 || >=16.0.0
- Sindre Sorhus
- released 11/1/2023