{"_id":"filter-files","_rev":"35558","name":"filter-files","description":"Recursively read directories and return a list of files, filtered to have only the files for which the (optional) filter function returns `true`. Sync and async.","dist-tags":{"latest":"0.4.0"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T10:07:42.000Z","created":"2014-10-29T23:36:16.455Z","0.4.0":"2014-11-17T12:29:46.980Z","0.3.1":"2014-11-17T08:58:25.923Z","0.3.0":"2014-11-15T15:18:58.127Z","0.2.5":"2014-11-13T11:56:17.924Z","0.2.4":"2014-10-30T07:53:09.951Z","0.2.3":"2014-10-30T07:47:49.170Z","0.2.2":"2014-10-30T05:44:16.325Z","0.2.1":"2014-10-30T05:41:50.647Z","0.2.0":"2014-10-30T05:28:15.037Z","0.1.0":"2014-10-29T23:36:16.455Z"},"users":{"andrebassi":true,"laomu":true,"lunelson":true},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/filter-files.git"},"versions":{"0.4.0":{"name":"filter-files","description":"Recursively read directories and return a list of files, filtered to have only the files for which the (optional) filter function returns `true`. Sync and async.","version":"0.4.0","homepage":"https://github.com/jonschlinkert/filter-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/filter-files.git"},"bugs":{"url":"https://github.com/jonschlinkert/filter-files/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/filter-files/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"dependencies":{"async":"^0.9.0","is-directory":"^0.2.2"},"devDependencies":{"benchmarked":"^0.1.3","chalk":"^0.5.1","glob":"^4.0.6","mocha":"*","should":"^4.1.0"},"keywords":["dir","directories","ext","extension","file","file-path","file-system","filepath","files","filter","fs","javascript","js","path","util","utils"],"_id":"filter-files@0.4.0","_shasum":"b934b9781a1a2f8daa8211b34bb8909706aeb914","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"b934b9781a1a2f8daa8211b34bb8909706aeb914","size":4095,"noattachment":false,"key":"/filter-files/-/filter-files-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/filter-files/download/filter-files-0.4.0.tgz"},"directories":{},"publish_time":1416227386980,"_cnpm_publish_time":1416227386980,"_hasShrinkwrap":false},"0.3.1":{"name":"filter-files","description":"Recursively read directories and return a list of files, filtered to have only the files for which the (optional) filter function returns `true`. Sync and async.","version":"0.3.1","homepage":"https://github.com/jonschlinkert/filter-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/filter-files.git"},"bugs":{"url":"https://github.com/jonschlinkert/filter-files/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/filter-files/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"dependencies":{"async":"^0.9.0","is-directory":"^0.2.2"},"devDependencies":{"benchmarked":"^0.1.3","chalk":"^0.5.1","glob":"^4.0.6","mocha":"*","should":"^4.1.0"},"keywords":["dir","directories","ext","extension","file","file-path","file-system","filepath","files","filter","fs","javascript","js","path","util","utils"],"_id":"filter-files@0.3.1","_shasum":"23f58dcdd291a12a20e69200369eefc9b090c040","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"23f58dcdd291a12a20e69200369eefc9b090c040","size":4182,"noattachment":false,"key":"/filter-files/-/filter-files-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/filter-files/download/filter-files-0.3.1.tgz"},"directories":{},"publish_time":1416214705923,"_cnpm_publish_time":1416214705923,"_hasShrinkwrap":false},"0.3.0":{"name":"filter-files","description":"Recursively read directories and return a list of files, filtered to have only the files for which the (optional) filter function returns `true`. Sync and async.","version":"0.3.0","homepage":"https://github.com/jonschlinkert/filter-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/filter-files.git"},"bugs":{"url":"https://github.com/jonschlinkert/filter-files/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/filter-files/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"dependencies":{"async":"^0.9.0","is-directory":"^0.2.2"},"devDependencies":{"benchmarked":"^0.1.3","chalk":"^0.5.1","glob":"^4.0.6","mocha":"*","should":"^4.1.0"},"keywords":["dir","directories","ext","extension","file","file-path","file-system","filepath","files","filter","fs","javascript","js","path","util","utils"],"_id":"filter-files@0.3.0","_shasum":"4a63cec27bbfcdb4a579cf59be036487a7e5ac79","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"4a63cec27bbfcdb4a579cf59be036487a7e5ac79","size":4176,"noattachment":false,"key":"/filter-files/-/filter-files-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/filter-files/download/filter-files-0.3.0.tgz"},"directories":{},"publish_time":1416064738127,"_cnpm_publish_time":1416064738127,"_hasShrinkwrap":false},"0.2.5":{"name":"filter-files","description":"Recursively read directories and return a list of files, filtered to have only the files for which the (optional) filter function returns `true`. Sync and async.","version":"0.2.5","homepage":"https://github.com/jonschlinkert/filter-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/filter-files.git"},"bugs":{"url":"https://github.com/jonschlinkert/filter-files/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/filter-files/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"dependencies":{"async":"^0.9.0","is-directory":"^0.2.2"},"devDependencies":{"benchmarked":"^0.1.3","chalk":"^0.5.1","glob":"^4.0.6","mocha":"*","should":"^4.1.0"},"keywords":["dir","directories","ext","extension","file","file-path","file-system","filepath","files","filter","fs","javascript","js","path","util","utils"],"_id":"filter-files@0.2.5","_shasum":"db507e3ba86adad86f8cd2cb27c3c998380996d5","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"db507e3ba86adad86f8cd2cb27c3c998380996d5","size":4113,"noattachment":false,"key":"/filter-files/-/filter-files-0.2.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/filter-files/download/filter-files-0.2.5.tgz"},"directories":{},"publish_time":1415879777924,"_cnpm_publish_time":1415879777924,"_hasShrinkwrap":false},"0.2.4":{"name":"filter-files","description":"Recursively read directories and return a list of files, filtered to have only the files for which the (optional) filter function returns `true`. Sync and async.","version":"0.2.4","homepage":"https://github.com/jonschlinkert/filter-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/filter-files.git"},"bugs":{"url":"https://github.com/jonschlinkert/filter-files/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/filter-files/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"benchmarked":"^0.1.3","chalk":"^0.5.1","glob":"^4.0.6","mocha":"*","should":"^4.1.0","verb":"^0.2.6"},"keywords":["dir","directories","ext","extension","file","file-path","file-system","filepath","files","filter","fs","javascript","js","path","util","utils"],"dependencies":{"async":"^0.9.0","is-directory":"^0.2.2"},"_id":"filter-files@0.2.4","_shasum":"be13b73e81bf353c3005e2fa78fb9850eeb084f2","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"be13b73e81bf353c3005e2fa78fb9850eeb084f2","size":4059,"noattachment":false,"key":"/filter-files/-/filter-files-0.2.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/filter-files/download/filter-files-0.2.4.tgz"},"directories":{},"publish_time":1414655589951,"_cnpm_publish_time":1414655589951,"_hasShrinkwrap":false},"0.2.3":{"name":"filter-files","description":"Recursively read directories and return a list of files, filtered to have only the files for which the (optional) filter function returns `true`. Sync and async.","version":"0.2.3","homepage":"https://github.com/jonschlinkert/filter-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/filter-files.git"},"bugs":{"url":"https://github.com/jonschlinkert/filter-files/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/filter-files/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"benchmarked":"^0.1.3","chalk":"^0.5.1","glob":"^4.0.6","mocha":"*","should":"^4.1.0","verb":"^0.2.6"},"keywords":["dir","directories","ext","extension","file","file-path","file-system","filepath","files","filter","fs","javascript","js","path","util","utils"],"dependencies":{"async":"^0.9.0","is-directory":"^0.2.2"},"_id":"filter-files@0.2.3","_shasum":"82690a883057cc301cb9a837f116763a1157dcd0","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"82690a883057cc301cb9a837f116763a1157dcd0","size":4050,"noattachment":false,"key":"/filter-files/-/filter-files-0.2.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/filter-files/download/filter-files-0.2.3.tgz"},"directories":{},"publish_time":1414655269170,"_cnpm_publish_time":1414655269170,"_hasShrinkwrap":false},"0.2.2":{"name":"filter-files","description":"Recursively read directories and return a list of files, filtered to have only the files for which the (optional) filter function returns `true`. Sync and async.","version":"0.2.2","homepage":"https://github.com/jonschlinkert/filter-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/filter-files.git"},"bugs":{"url":"https://github.com/jonschlinkert/filter-files/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/filter-files/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"benchmarked":"^0.1.3","chalk":"^0.5.1","glob":"^4.0.6","mocha":"*","should":"^4.1.0","verb":"^0.2.6"},"keywords":["dir","directories","ext","extension","file","file-path","file-system","filepath","files","filter","fs","javascript","js","path","util","utils"],"dependencies":{"async":"^0.9.0","is-directory":"^0.2.2"},"_id":"filter-files@0.2.2","_shasum":"25d5f1121021c6084c441b8d6a52d4b32e187251","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"25d5f1121021c6084c441b8d6a52d4b32e187251","size":3881,"noattachment":false,"key":"/filter-files/-/filter-files-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/filter-files/download/filter-files-0.2.2.tgz"},"directories":{},"publish_time":1414647856325,"_cnpm_publish_time":1414647856325,"_hasShrinkwrap":false},"0.2.1":{"name":"filter-files","description":"Recursively read directories and return a list of files, filtered to have only the files for which the (optional) filter function returns `true`. Sync and async.","version":"0.2.1","homepage":"https://github.com/jonschlinkert/filter-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/filter-files.git"},"bugs":{"url":"https://github.com/jonschlinkert/filter-files/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/filter-files/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"benchmarked":"^0.1.3","chalk":"^0.5.1","glob":"^4.0.6","mocha":"*","should":"^4.1.0","verb":"^0.2.6"},"keywords":["dir","directories","ext","extension","file","file-path","file-system","filepath","files","filter","fs","javascript","js","path","util","utils"],"dependencies":{"async":"^0.9.0","is-directory":"^0.2.2"},"_id":"filter-files@0.2.1","_shasum":"d6dfbc97bf2470ba2aca4fffc3efc4dd2876a57e","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"d6dfbc97bf2470ba2aca4fffc3efc4dd2876a57e","size":3905,"noattachment":false,"key":"/filter-files/-/filter-files-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/filter-files/download/filter-files-0.2.1.tgz"},"directories":{},"publish_time":1414647710647,"_cnpm_publish_time":1414647710647,"_hasShrinkwrap":false},"0.2.0":{"name":"filter-files","description":"Recursively read directories and return a list of files, filtered to have only the files for which the (optional) filter function returns `true`. Sync and async.","version":"0.2.0","homepage":"https://github.com/jonschlinkert/filter-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/filter-files.git"},"bugs":{"url":"https://github.com/jonschlinkert/filter-files/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/filter-files/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"benchmarked":"^0.1.3","chalk":"^0.5.1","glob":"^4.0.6","mocha":"*","should":"^4.1.0","verb":"^0.2.6"},"keywords":["dir","directories","ext","extension","file","file-path","file-system","filepath","files","filter","fs","javascript","js","path","util","utils"],"dependencies":{"async":"^0.9.0","is-directory":"^0.2.2"},"_id":"filter-files@0.2.0","_shasum":"1b4ea0a8db0fd72cf59f5b2d295d8849e2a57353","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"1b4ea0a8db0fd72cf59f5b2d295d8849e2a57353","size":7521,"noattachment":false,"key":"/filter-files/-/filter-files-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/filter-files/download/filter-files-0.2.0.tgz"},"directories":{},"publish_time":1414646895037,"_cnpm_publish_time":1414646895037,"_hasShrinkwrap":false},"0.1.0":{"name":"filter-files","description":"Recursively read directories and return a list of files filtered to have only the files for which the callback returns `true`.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/filter-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/filter-files.git"},"bugs":{"url":"https://github.com/jonschlinkert/filter-files/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/filter-files/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"verb":"^0.2.6","mocha":"*"},"keywords":["fs","read","dir","directories"],"dependencies":{"is-directory":"^0.2.2"},"_id":"filter-files@0.1.0","_shasum":"e10f6dae953b2cf8e15927ea8755bedb00ac8e49","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"e10f6dae953b2cf8e15927ea8755bedb00ac8e49","size":4425,"noattachment":false,"key":"/filter-files/-/filter-files-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/filter-files/download/filter-files-0.1.0.tgz"},"directories":{},"publish_time":1414625776455,"_cnpm_publish_time":1414625776455,"_hasShrinkwrap":false}},"readme":"# filter-files [![NPM version](https://badge.fury.io/js/filter-files.svg)](http://badge.fury.io/js/filter-files)\n\n> Recursively read directories and return a list of files, filtered to have only the files for which the (optional) filter function returns `true`. Sync and async.\n\n## Install\n### Install with [npm](npmjs.org)\n\n```bash\nnpm i filter-files --save\n```\n\n## Run tests\n\n```bash\nnpm test\n```\n\n## Usage\n\n```js\nvar filter = require('filter-files');\n```\n\n### sync\n\n```js\nfilter.sync(dir, [recurse], [filterFn]);\n```\n**Params**\n\n - `dir` **{String}**: the directory to start from. Returns all files, recursively, starting with this path.\n - `filterFn` **{Function}**: optionally pass a filter function to use for filtering files/dirs. This function filters \"on the fly\", so recursion is very fast.\n - `recurse` **{Boolean}**: pass `false` to disable recursion.\n\n**Examples**\n\n```js\nvar files = filter.sync('lib');\nconsole.log(files);\n//=> [ 'lib/async.js', 'lib/filter.js', 'lib/sync.js' ]\n```\n\nPass a filter function:\n\n```js\nfilter.sync('lib', function(fp) {\n  return /a/.test(fp);\n});\n//=> [ 'lib/async.js' ]\n```\n\nOr an array of filter functions:\n\n```js\nfunction include(fp) {\n  return /^\\./.test(fp);\n}\nfunction exclude(fp) {\n  return !/^\\.[jntv]/.test(fp);\n}\n\n// pass `false` to prevent recursion\nfilter('.', [include, exclude], false);\n//=> ['.git', '.gitignore', '.gitattribuets']\n```\n\n### async\n\n```js\nfilter(dir, [recurse], [filterFn], callback));\n```\n**Params**\n\nSame as sync with the addition of `callback`.\n\n**Examples**\n\n```js\nfilter('lib', function(err, files) {\n  console.log(files);\n  //=> [ 'lib/async.js', 'lib/filter.js', 'lib/sync.js' ]\n});\n```\n\nPass a filter function:\n\n```js\nvar fn = function(fp) {\n  return /a/.test(fp);\n};\n\nfilter('lib', fn, function(err, files) {\n  console.log(files);\n  //=> [ 'lib/async.js' ]\n});\n```\n\n### Filtering\n\nFilter functions take four parameters and return `true` or `false`.\n\n**Params**\n\n - `fp` filepath being looped over\n - `dir` current directory\n - `files` accumulated array of files\n - `recurse` whether recurse is `true` or `false`\n\n**Example**\n\nThis function returns a filter function for getting files with the given `extname`:\n\n```js\nvar path = require('path');\nvar isDir = require('is-directory');\n\nfunction ext(extname) {\n  // this is our filter function\n  return function filter(fp, dir, files, recurse) {\n    if (isDir(path.join(dir, fp)) && recurse === true) {\n      return true;\n    }\n    return path.extname(fp) === extname;\n  }\n}\n```\n\nSee [the tests](./test/test.js) for more examples.\n\n\n## Contributing\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/filter-files/issues).\n\n## Author\n\n**Jon Schlinkert**\n \n+ [github/jonschlinkert](https://github.com/jonschlinkert)\n+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) \n\n## License\nCopyright (c) 2014 Jon Schlinkert  \nReleased under the MIT license\n\n***\n\n_This file was generated by [verb](https://github.com/assemble/verb) on November 17, 2014._","_attachments":{},"homepage":"https://github.com/jonschlinkert/filter-files","bugs":{"url":"https://github.com/jonschlinkert/filter-files/issues"}}