/rev-file

Get the revved file path of a file

Primary LanguageJavaScriptMIT LicenseMIT

rev-file Build Status

Get the revved file path of a file

Reads the file, MD5 hashes it, truncates the hash to 10 characters, appends it to the filename, and returns the modified path.

Install

$ npm install --save rev-file

Usage

const revFile = require('rev-file');

revFile('src/unicorn.png').then(filpath => {
	console.log(filepath);
	//=> 'src/unicorn-bb9d8fe615.png'
});

API

revFile(filepath)

Returns a promise for a revved filepath.

revFile.sync(filepath)

Return a revved filepath.

License

MIT © Sindre Sorhus