Multiple glob expansions with exclusions and hooks
Multiple glob expansions with exclusions and hooks. Possible to use asynchrounously and synchronously.
$ npm install gloth
var excludeSizeHigherThen = require'hooks/excludeSizeHigherThen';gloth'src/**/*' '!b.js' excludeSizeHigherThen2097152// Do things with matches
var excludeSizeHigherThen = require'hooks/excludeSizeHigherThen';var matches = glothsync'src/**/*' '!b.js' excludeSizeHigherThen2097152;// Do things with matches
The example above would expand all files in the
src folder, exclude any file named
b.js and run the
excludeSizeHigherThen hook. This hook would look something like:
var fs = require'fs';returnreturn matchesfiltervar stat = fsstatSyncmatch;return !statisFile || statsize <= size;;;;
The hook above was written synchronously. The asynchronous version would be:
var fs = require'fs';var async = require'async';returnasyncfiltermatchesfsstatmatchif err return nextfalse;next!statisFile || statsize <= size;;nextnull results;;;;
For more information on hooks are done, people check the built-in hooks in the source code.
options available are the same as the glob ones.
IMPORTANT: sync hooks can be run in gloth async and sync, but async hooks can only be used with gloth async.
Released under the MIT License.