Get staged files for use in git hooks or some task runner.
From the command line (mostly useful for systems without xargs
).
staged-files 'optional-pattern/**' -- optional_command
Vinyl compatible stream.
var fs = require('vinyl-fs');
var stagedFiles = require('staged-files');
stagedFiles()
.pipe(fs.src(['**/*.js'], { passthrough: true }))
.pipe(fs.dest('./output'));