This is currently a built-in middleware with glob-fs, but it can also be used directly if the default middleware stack is disabled.
var gitignore = require('{%= name %}');
Middleware is defined the same way with all readdir methods (e.g. glob.readdir
, glob.readdirSync
, glob.readdirStream
and glob.readdirPromise
):
var glob = require('glob-fs')({ dotfiles: true })
.use(gitignore()) // <= middleware
.readdir('*', function (err, files) {
console.log(files);
});