code: function fileset(include, exclude, options, cb) {
    if (typeof exclude === 'function') cb = exclude, exclude = '';
    else if (typeof options === 'function') cb = options, options = {};
  
    var includes = (typeof include === 'string') ? include.split(' ') : include;
    var excludes = (typeof exclude === 'string') ? exclude.split(' ') : exclude;
  
    var em = new EventEmitter;
    var remaining = includes.length;
    var results = [];
  
    if (!includes.length) return cb(new Error('Must provide an include pattern'));
  
    em.includes = includes.map(function(pattern) {
      return new fileset.Fileset(pattern, options)
        .on('error', cb ? cb : em.emit.bind(em, 'error'))
        .on('match', em.emit.bind(em, 'match'))
        .on('match', em.emit.bind(em, 'include'))
        .on('end', next.bind({}, pattern))
    });
  
    function next(pattern, matches) {
      results = results.concat(matches);
  
      if (!(--remaining)) {
        results = results.filter(function(file) {
          return !excludes.filter(function(glob) {
            var match = minimatch(file, glob, { matchBase: true });
            if(match) em.emit('exclude', file);
            return match;
          }).length;
        });
  
        if(cb) cb(null, results);
        em.emit('end', results);
      }
    }
  
    return em;
  }
docs: Async API