Package Exports
- fileset
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fileset) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
node-fileset
Expose a basic wrapper around node-glob by isaacs and findit by substack. Enable multiple pattern matching, and include exlude ability.
install
npm install filesetusage
fileset
Can be used with callback or emitter style.
- include: list of glob patterns
foo/**/*.js *.md src/lib/**/* - exclude: optional list of glob patterns to filter include results
foo/**/*.js *.md - callback: optional function that gets called with an error if something wrong happend, otherwise null with an array of results
The callback is optional since the fileset method return an instance of EventEmitter which emit different events you might use:
- match: triggered on findit.file and each glob returned by node-glob, triggerd multiple times
- includes: array of includes files, triggered once
- excludes: array of exclude files, triggered once
- end: array of include files, filter by exluded files, triggered once
callback
var fileset = require('fileset');
fileset('**/*.js', '**.min.js', function(err, files) {
if (err) return console.error(err);
console.log('Files: ', files.length);
console.log(files);
});event emitter
var fileset = require('fileset');
fileset('**/*.js', '**.min.js')
.on('match', console.log.)tests
just run npm test (make sure to install devDependencies too)
why
mainly as a build tool with cake files, to provide me an easy way to get a list of files by either using glob or path patterns, optionnaly allowing exclude patterns to filter out the results.
All the magic is happening in node-glob and findity, check them out !