Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rev-hash

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rev-hash - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

12

index.d.ts

@@ -1,2 +0,2 @@

/// <reference types="node" />
import {Buffer} from 'node:buffer';

@@ -6,8 +6,8 @@ /**

@param input - Data to create a hash from.
@param data - The data to create a hash from.
@example
```
import * as fs from 'fs';
import revisionHash = require('rev-hash');
import fs from 'node:fs';
import revisionHash from 'rev-hash';

@@ -21,4 +21,2 @@ revisionHash(fs.readFileSync('unicorn.png'));

*/
declare function revisionHash(input: Buffer | string): string;
export = revisionHash;
export default function revisionHash(data: Buffer | string): string;

@@ -1,10 +0,10 @@

'use strict';
const crypto = require('crypto');
import crypto from 'node:crypto';
import {Buffer} from 'node:buffer';
module.exports = input => {
if (typeof input !== 'string' && !Buffer.isBuffer(input)) {
export default function revisionHash(data) {
if (typeof data !== 'string' && !Buffer.isBuffer(data)) {
throw new TypeError('Expected a Buffer or string');
}
return crypto.createHash('md5').update(input).digest('hex').slice(0, 10);
};
return crypto.createHash('md5').update(data).digest('hex').slice(0, 10);
}
{
"name": "rev-hash",
"version": "3.0.0",
"version": "4.0.0",
"description": "Create a hash for file revving",
"license": "MIT",
"repository": "sindresorhus/rev-hash",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=8"
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},

@@ -36,7 +39,7 @@ "scripts": {

"devDependencies": {
"@types/node": "^11.13.7",
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"@types/node": "^16.11.7",
"ava": "^3.15.0",
"tsd": "^0.18.0",
"xo": "^0.46.4"
}
}

@@ -1,2 +0,2 @@

# rev-hash [![Build Status](https://travis-ci.org/sindresorhus/rev-hash.svg?branch=master)](https://travis-ci.org/sindresorhus/rev-hash)
# rev-hash

@@ -7,17 +7,15 @@ > Create a hash for file revving

If you think you need a different hash algorithm or a longer hash, [you're wrong](http://blog.risingstack.com/automatic-cache-busting-for-your-css/).
If you think you need a different hash algorithm or a longer hash, [you're wrong](https://blog.risingstack.com/automatic-cache-busting-for-your-css/).
## Install
```sh
npm install rev-hash
```
$ npm install rev-hash
```
## Usage
```js
const fs = require('fs');
const revisionHash = require('rev-hash');
import fs from 'node:fs';
import revisionHash from 'rev-hash';

@@ -31,3 +29,2 @@ revisionHash(fs.readFileSync('unicorn.png'));

## API

@@ -41,7 +38,2 @@

Data to create a hash from.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
The data to create a hash from.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc