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.
npm install rev-hash
import fs from 'node:fs';
import revisionHash from 'rev-hash';
revisionHash(fs.readFileSync('unicorn.png'));
//=> 'bb9d8fe615'
revisionHash('Lorem ipsum dolor sit amet');
//=> 'fea80f2db0'
Type: Uint8Array | string
The data to create a hash from.
Overall
Maintained
Code review
npm
Latest release
Releases this year
537 followers · starred Jun 2018
1,657 followers · starred May 2015
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.
npm install rev-hash
import fs from 'node:fs';
import revisionHash from 'rev-hash';
revisionHash(fs.readFileSync('unicorn.png'));
//=> 'bb9d8fe615'
revisionHash('Lorem ipsum dolor sit amet');
//=> 'fea80f2db0'
Type: Uint8Array | string
The data to create a hash from.
Overall
Maintained
Code review
npm
Latest release
Releases this year
537 followers · starred Jun 2018
1,657 followers · starred May 2015