rev-hash
Create a hash for file revving
Last updated 2 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install rev-hash 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 4.1.0                                ...           latest (2 years ago)

5 Versions

  • 4.1.0                                ...           2 years ago
  • 4.0.0                                ...           4 years ago
  • 3.0.0                                ...           7 years ago
  • 2.0.0                                ...           9 years ago
  • 1.0.0                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 5
Dependencies (0)
None
Dev Dependencies (4)

Copyright 2013 - present © cnpmjs.org | Home |