gulp-filehash

1.0.0 • Public • Published

gulp-filehash

NPM Version NPM Downloads Node.js Version Build Status codecov

Output list of files in current stream to JSON file with their checksum hashes .

Add it to your gulp file:

gulp
  .src(['awesome.file', 'lame.file'])
  .pipe(require('gulp-filehash')('filehash.json'))
  .pipe(gulp.dest('out'))

Outputs out/filehash.json:

{
  "awesome.file" : "79550af37b9f41fc0fe382b8e5fc67c3e160db8b",
  "lame.file" : "6a7177d9a0fd176dbbf7165693319d1fc5acdf58"
}

Installation

$ npm install gulp-filehash

Options

Base : { base: 'dist' }

gulp
  .src(['dist/dir1/awesome.file', 'dist/dir2/lame.file'])
  .pipe(require('gulp-filehash')('filehash.json', { base: 'dist' }))
  .pipe(gulp.dest('out'))

Outputs:

{
  "dir1/awesome.file" : "79550af37b9f41fc0fe382b8e5fc67c3e160db8b",
  "dir2/lame.file" : "6a7177d9a0fd176dbbf7165693319d1fc5acdf58"
}

Script: { script: true }

gulp
  .src(['awesome.file', 'lame.file'])
  .pipe(require('gulp-filehash')('filehash.json', { script: true }))
  .pipe(gulp.dest('out'))

Outputs out/filehash.json:

var fileHashes = {
  "awesome.file" : "79550af37b9f41fc0fe382b8e5fc67c3e160db8b",
  "lame.file" : "6a7177d9a0fd176dbbf7165693319d1fc5acdf58"
}

Script with Variable Name: { script: 'hashes' }

gulp
  .src(['awesome.file', 'lame.file'])
  .pipe(require('gulp-filehash')('filehash.json', { script: 'hashes' }))
  .pipe(gulp.dest('out'))

Outputs out/filehash.json:

var hashes = {
  "awesome.file" : "79550af37b9f41fc0fe382b8e5fc67c3e160db8b",
  "lame.file" : "6a7177d9a0fd176dbbf7165693319d1fc5acdf58"
}

MIT Licensed

Package Sidebar

Install

npm i gulp-filehash

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • raaghukr