gulp-sha256-filename
v2.0.0
Published
gulp-sha256-filename is a gulp plug-in rename file with sha256.
Downloads
26
Maintainers
Readme
Usage of gulp-sha256-filename
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'))
});