npm.io
2.0.0 • Published 7 years ago

gulp-sha256-filename

Licence
MIT
Version
2.0.0
Deps
0
Size
14 kB
Vulns
0
Weekly
0
Stars
1

Usage of gulp-sha256-filename

NPM version Downloads Build Status Coverage Status

It's plugin for gulp rename file output with sha256 hash sum.

Installation

npm i gulp-sha256-filename

or

npm i -D gulp-sha256-filename

Example of the hash() function

Here is an example of how to use the hash() function in your gulpfile.js file:

const gulp = require('gulp');
const hash = require('gulp-sha256-filename');

gulp.task('assemble', function() {
return gulp.src('./assembly.json')
	.pipe(hash())
	.pipe(gulp.dest('./dist'))
});
Filename custom format

You can set a custom format for filename.

const gulp = require('gulp');
const hash = require('gulp-sha256-filename');

gulp.task('assemble', function() {
return gulp.src('./assembly.json')
	.pipe(hash({
		format:"{name}.{hash}{ext}"
	}))
	.pipe(gulp.dest('./dist'))
});

and set limit length at hash

const gulp = require('gulp');
const hash = require('gulp-sha256-filename');

gulp.task('assemble', function() {
return gulp.src('./assembly.json')
	.pipe(hash({
		format:"{name}.{hash:8}{ext}"
	}))
	.pipe(gulp.dest('./dist'))
});

Keywords