rev-hash

Create a hash for file revving

MIT 5 个版本
安装
npm install rev-hash
yarn add rev-hash
pnpm add rev-hash
bun add rev-hash
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.

版本列表
4.1.0 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