{"_id":"glob-fs","_rev":"23-5cac4ab70e611537c9aaaacbb4ad0203","name":"glob-fs","description":"file globbing for node.js. speedy and powerful alternative to node-glob.","dist-tags":{"latest":"0.1.7"},"versions":{"0.1.0":{"name":"glob-fs","description":"file globbing, for node.js.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/glob-fs","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/glob-fs.git"},"bugs":{"url":"https://github.com/jonschlinkert/glob-fs/issues"},"license":"MIT","files":["index.js","middleware/","lib/"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"async":"^1.3.0","bluebird":"^2.9.32","component-emitter":"^1.2.0","export-files":"^2.0.1","extend-shallow":"^2.0.0","glob-parent":"^1.2.0","graceful-fs":"^4.1.2","is-dotdir":"^0.1.0","is-dotfile":"^1.0.1","is-glob":"^2.0.0","kind-of":"^2.0.0","lazy-cache":"^0.1.0","micromatch":"^2.1.6","minimatch":"^2.0.8","object-visit":"^0.1.0","object.omit":"^1.1.0","parse-gitignore":"^0.1.2","through2":"^2.0.0"},"devDependencies":{"mocha":"*","should":"*"},"keywords":["file","fs","glob","match","path"],"gitHead":"33dddc3015db743b9c304b6495ea8016080a9681","_id":"glob-fs@0.1.0","_shasum":"3edad5a57b0761629d09c9914a83695de57eb5d3","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"3edad5a57b0761629d09c9914a83695de57eb5d3","tarball":"https://registry.npmjs.org/glob-fs/-/glob-fs-0.1.0.tgz","integrity":"sha512-o+HnF8quBnTnmUYkrv7/nlZ4uPa3G260DYgKqyTSFgjMOZqn93tlvorxeQscDVFlqmQcUp6zpJlPZ36xCGQZ8Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFnjxJIVGrkm3RlkIE51E6UFVSDqFf4le/+P6ArOBDzbAiEA2LATazoUgMqDMsyt8PPnWy/tIwM793zza4RB5j2QtV8="}]}},"0.1.2":{"name":"glob-fs","description":"file globbing for node.js. speedy and powerful alternative to node-glob.","version":"0.1.2","homepage":"https://github.com/jonschlinkert/glob-fs","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/glob-fs.git"},"bugs":{"url":"https://github.com/jonschlinkert/glob-fs/issues"},"license":"MIT","files":["index.js","middleware/","lib/"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"async":"^1.3.0","bluebird":"^2.9.32","component-emitter":"^1.2.0","export-files":"^2.0.1","extend-shallow":"^2.0.0","glob-fs-dotfiles":"^0.1.1","glob-fs-gitignore":"^0.1.0","glob-parent":"^1.2.0","graceful-fs":"^4.1.2","is-glob":"^2.0.0","kind-of":"^2.0.0","lazy-cache":"^0.1.0","micromatch":"^2.1.6","object-visit":"^0.1.0","object.omit":"^1.1.0","through2":"^2.0.0"},"devDependencies":{"mocha":"*","should":"*"},"keywords":["file","fs","glob","match","path"],"gitHead":"87ab4b54c8d9637cd87b25e74040860e8b270ec9","_id":"glob-fs@0.1.2","_shasum":"70fb1b1f7afe85103dab2ecbc4229f34a1c077ec","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"70fb1b1f7afe85103dab2ecbc4229f34a1c077ec","tarball":"https://registry.npmjs.org/glob-fs/-/glob-fs-0.1.2.tgz","integrity":"sha512-h5Myr7EQkFgLWgUKhe36VCjmmyah/kjNXJGSd40cJ97aoXJTR6f3aUAj6TW2HLGHbK3hspuTwK8ZN7z0QT9mdw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCLo6P3WvIe/Dais6yz01v3bsrSCGKHfSKoVqgduvBjZgIhAPmnQXkov9JpeeSiv2DzWpFc6BdgTM1vqNANEx9t/u+C"}]}},"0.1.3":{"name":"glob-fs","description":"file globbing for node.js. speedy and powerful alternative to node-glob.","version":"0.1.3","homepage":"https://github.com/jonschlinkert/glob-fs","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/glob-fs.git"},"bugs":{"url":"https://github.com/jonschlinkert/glob-fs/issues"},"license":"MIT","files":["index.js","middleware/","lib/"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"async":"^1.3.0","bluebird":"^2.9.32","component-emitter":"^1.2.0","export-files":"^2.0.1","extend-shallow":"^2.0.0","glob-fs-dotfiles":"^0.1.1","glob-fs-gitignore":"^0.1.0","glob-parent":"^1.2.0","graceful-fs":"^4.1.2","is-glob":"^2.0.0","kind-of":"^2.0.0","lazy-cache":"^0.1.0","micromatch":"^2.1.6","object-visit":"^0.1.0","object.omit":"^1.1.0","through2":"^2.0.0"},"devDependencies":{"mocha":"*","should":"*"},"keywords":["file","fs","glob","match","path"],"gitHead":"a738734a4aa92919c365808f01e4049288acadaf","_id":"glob-fs@0.1.3","_shasum":"7fe9a85fdd1312610d45ecd9ad127fc5a77b2bb7","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"7fe9a85fdd1312610d45ecd9ad127fc5a77b2bb7","tarball":"https://registry.npmjs.org/glob-fs/-/glob-fs-0.1.3.tgz","integrity":"sha512-aM7HngLVmUMvUpI4vKr0gZBh25Aj+HQOiSNDckZ0QQ7ehyiyFJhP1sJ+xKybexoWm9/MylEiOp7b1KySY5RFcg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEjRWf92WXlsxQT8VKFFuXYNDretI5Ya3WjY1E3BhIvIAiBIn8S9v8yrVjvvgnfpwVqxZSl+EtEEldwAuKlmy1dCvQ=="}]}},"0.1.5":{"name":"glob-fs","description":"file globbing for node.js. speedy and powerful alternative to node-glob.","version":"0.1.5","homepage":"https://github.com/jonschlinkert/glob-fs","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/glob-fs.git"},"bugs":{"url":"https://github.com/jonschlinkert/glob-fs/issues"},"license":"MIT","files":["index.js","middleware/","lib/"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"async":"^1.3.0","bluebird":"^2.9.33","component-emitter":"^1.2.0","export-files":"^2.0.1","extend-shallow":"^2.0.0","glob-fs-dotfiles":"^0.1.5","glob-fs-gitignore":"^0.1.3","glob-parent":"^1.2.0","graceful-fs":"^4.1.2","is-glob":"^2.0.0","kind-of":"^2.0.0","lazy-cache":"^0.1.0","micromatch":"github:jonschlinkert/micromatch#2.2.0","mixin-object":"^2.0.0","object-visit":"^0.1.0","object.omit":"^1.1.0","relative":"^3.0.1","through2":"^2.0.0"},"devDependencies":{"mocha":"*","should":"*"},"keywords":["file","fs","glob","match","path"],"gitHead":"d632e744c44ec9c545b1eded1113054ea0740f73","_id":"glob-fs@0.1.5","_shasum":"d8f5bf33b550ea7a84d7dce420d55eab6eaaa27e","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"d8f5bf33b550ea7a84d7dce420d55eab6eaaa27e","tarball":"https://registry.npmjs.org/glob-fs/-/glob-fs-0.1.5.tgz","integrity":"sha512-wZ0sDc8BGap4MS5f1/igchUdMS9IpPyZdhfvhymisd1Gu72vVdMkpO/+5VQ0sVaoXYrHIVHvJK2dgCkd067hqg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDEj8WVc5vI/K6DFYw3WMllpyqQS47b9FLi6fHjmNOVqQIhAPcCPTuSkWj+V9bilKFPy5Oj+/w6Vgy2E+A8Il/j8OY9"}]}},"0.1.6":{"name":"glob-fs","description":"file globbing for node.js. speedy and powerful alternative to node-glob.","version":"0.1.6","homepage":"https://github.com/jonschlinkert/glob-fs","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/glob-fs.git"},"bugs":{"url":"https://github.com/jonschlinkert/glob-fs/issues"},"license":"MIT","files":["index.js","middleware/","lib/"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"async":"^1.3.0","bluebird":"^2.9.33","component-emitter":"^1.2.0","ends-with":"^0.2.0","export-files":"^2.0.1","extend-shallow":"^2.0.0","get-value":"^1.1.5","glob-fs-dotfiles":"^0.1.6","glob-fs-gitignore":"^0.1.5","glob-parent":"^1.2.0","graceful-fs":"^4.1.2","is-dotdir":"^0.1.0","is-dotfile":"^1.0.1","is-glob":"^2.0.0","is-windows":"^0.1.0","kind-of":"^2.0.0","lazy-cache":"^0.1.0","micromatch":"github:jonschlinkert/micromatch#2.2.0","mixin-object":"^2.0.0","object-visit":"^0.1.0","object.omit":"^1.1.0","parse-filepath":"^0.6.1","relative":"^3.0.1","set-value":"^0.2.0","starts-with":"^1.0.2","through2":"^2.0.0"},"devDependencies":{"mocha":"*","should":"*"},"keywords":["file","fs","glob","match","path"],"gitHead":"fd439bd7123e2010d09be23efd8d95a4b2118339","_id":"glob-fs@0.1.6","_shasum":"ffcd3c3c2d585749b938b1c22e3bc7a08b5c497a","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"ffcd3c3c2d585749b938b1c22e3bc7a08b5c497a","tarball":"https://registry.npmjs.org/glob-fs/-/glob-fs-0.1.6.tgz","integrity":"sha512-qTVUc8qWELEaUv5frhRlcT1Hffh2HoFujpdLKtZVMk0s25P9uC/xF6MdBkEk2Emnw3fiuQsbe6rBMiBT/NR7Xw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA897tOZaZUXOXBfO6uO6z8jsXR/5/NInXk3EDCW6soJAiEAsieZsrDSLQQOhZM4FfSDETiM1J4Ont5WW2wjO9ZDaVI="}]}},"0.1.7":{"name":"glob-fs","description":"file globbing for node.js. speedy and powerful alternative to node-glob.","version":"0.1.7","homepage":"https://github.com/jonschlinkert/glob-fs","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/glob-fs.git"},"bugs":{"url":"https://github.com/jonschlinkert/glob-fs/issues"},"license":"MIT","files":["index.js","middleware/","lib/"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"async":"^1.3.0","bluebird":"^2.9.33","component-emitter":"^1.2.0","ends-with":"^0.2.0","export-files":"^2.0.1","extend-shallow":"^2.0.0","get-value":"^1.1.5","glob-fs-dotfiles":"^0.1.6","glob-fs-gitignore":"^0.1.5","glob-parent":"^1.2.0","graceful-fs":"^4.1.2","is-dotdir":"^0.1.0","is-dotfile":"^1.0.1","is-glob":"^2.0.0","is-windows":"^0.1.0","kind-of":"^2.0.0","lazy-cache":"^0.1.0","micromatch":"github:jonschlinkert/micromatch#2.2.0","mixin-object":"^2.0.0","object-visit":"^0.1.0","object.omit":"^1.1.0","parse-filepath":"^0.6.1","relative":"^3.0.1","set-value":"^0.2.0","starts-with":"^1.0.2","through2":"^2.0.0"},"devDependencies":{"mocha":"*","should":"*"},"keywords":["file","fs","glob","match","path"],"gitHead":"313d9678d74723ec60893a5965eb98403e972a89","_id":"glob-fs@0.1.7","_npmVersion":"5.3.0","_nodeVersion":"7.7.3","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"email":"brian.woodward@gmail.com","name":"doowb"},{"email":"github@sellside.com","name":"jonschlinkert"}],"dist":{"integrity":"sha512-f0U3u9xK8MEYtKDCnZXvZrZAy4uNp+KSA4xfaKI/NxbE6HXhqUBQ485Uwd6jQa/Q6z1yKi804WT9y53RrwuMxQ==","shasum":"9a7ebbfc694fae9cebec5d59dace93ecfb364f26","tarball":"https://registry.npmjs.org/glob-fs/-/glob-fs-0.1.7.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH8d71sFCPRGf+AuL8lrjXk3vfiKRMkUigPfVm1hz3lnAiB6L5sRLt5/qRzFJ4WNSnHQCvaq6TozF5C+sx+MZM24FA=="}]},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/glob-fs-0.1.7.tgz_1500563683463_0.618085011607036"}}},"readme":"# glob-fs [![NPM version](https://badge.fury.io/js/glob-fs.svg)](http://badge.fury.io/js/glob-fs)\n\n> file globbing for node.js. speedy and powerful alternative to node-glob.\n\n## Usage\n\n```js\nvar glob = require('glob-fs')({ gitignore: true });\nvar files = glob.readdirSync('**/*.js');\n```\n\n[Run actual examples](./examples/):\n\nJump to docs sections:\n\n* [glob.readdir](#async)\n* [glob.readPromise](#promise)\n* [glob.readStream](#stream)\n* [glob.readdirSync](#sync)\n\n## Table of contents\n\n<!-- toc -->\n\n* [Install](#install)\n* [Usage](#usage)\n* [API](#api)\n* [Middleware](#middleware)\n  - [Middleware examples](#middleware-examples)\n  - [Middleware conventions](#middleware-conventions)\n  - [Advice for middleware authors](#advice-for-middleware-authors)\n* [Globbing examples](#globbing-examples)\n  - [async](#async)\n  - [promise](#promise)\n  - [stream](#stream)\n  - [sync](#sync)\n* [Events](#events)\n  - [Event examples](#event-examples)\n* [FAQ](#faq)\n* [TODO](#todo)\n* [Community middleware](#community-middleware)\n* [Related projects](#related-projects)\n* [Running tests](#running-tests)\n* [Contributing](#contributing)\n* [Author](#author)\n* [License](#license)\n\n_(Table of contents generated by [verb](https://github.com/assemble/verb))_\n\n<!-- tocstop -->\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/)\n\n```sh\n$ npm i glob-fs --save\n```\n\n## Usage\n\n**Params**\n\nAll \"read\" methods take a glob pattern and an `options` object.\n\n* `pattern` **{String}**: Glob pattern to use for matching. (multiple pattern support is planned)\n* `options` **{Object}**: Options for `glob-fs` or middleware.\n\n**Examples:**\n\n```js\n// sync\nvar files = glob.readdirSync('*.js', {});\n\n// async\nglob.readdir('*.js', function(err, files) {\n  console.log(files);\n});\n\n// stream\nglob.readdirStream('*.js', {})\n  .on('data', function(file) {\n    console.log(file);\n  });\n\n// promise\nglob.readdirPromise('*.js')\n  .then(function(files) {\n    console.log(file);\n  });\n```\n\n## API\n\n### [.readdir](lib/readers.js#L25)\n\nAsynchronously glob files or directories that match the given `pattern`.\n\n**Params**\n\n* `pattern` **{String}**: Glob pattern\n* `options` **{Object}**\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nvar glob = require('glob-fs')({ gitignore: true });\n\nglob.readdir('*.js', function (err, files) {\n  //=> do stuff with `files`\n});\n```\n\n### [.readdirSync](lib/readers.js#L59)\n\nSynchronously glob files or directories that match the given `pattern`.\n\n**Params**\n\n* `pattern` **{String}**: Glob pattern\n* `options` **{Object}**\n* `returns` **{Array}**: Returns an array of files.\n\n**Example**\n\n```js\nvar glob = require('glob-fs')({ gitignore: true });\n\nvar files = glob.readdirSync('*.js');\n//=> do stuff with `files`\n```\n\n### [.readdirStream](lib/readers.js#L90)\n\nStream files or directories that match the given glob `pattern`.\n\n**Params**\n\n* `pattern` **{String}**: Glob pattern\n* `options` **{Object}**\n* `returns` **{Stream}**\n\n**Example**\n\n```js\nvar glob = require('glob-fs')({ gitignore: true });\n\nglob.readdirStream('*.js')\n  .on('data', function (file) {\n    console.log(file.path);\n  })\n  .on('error', console.error)\n  .on('end', function () {\n    console.log('end');\n  });\n```\n\n### [Glob](index.js#L42)\n\nOptionally create an instance of `Glob` with the given `options`.\n\n**Params**\n\n* `options` **{Object}**\n\n**Example**\n\n```js\nvar Glob = require('glob-fs').Glob;\nvar glob = new Glob();\n```\n\n### [.use](index.js#L178)\n\nAdd a middleware to be called in the order defined.\n\n**Params**\n\n* `fn` **{Function}**\n* `returns` **{Object}**: Returns the `Glob` instance, for chaining.\n\n**Example**\n\n```js\nvar gitignore = require('glob-fs-gitignore');\nvar dotfiles = require('glob-fs-dotfiles');\nvar glob = require('glob-fs')({ foo: true })\n  .use(gitignore())\n  .use(dotfiles());\n\nvar files = glob.readdirSync('**');\n```\n\n### [.exclude](index.js#L219)\n\nThin wrapper around `.use()` for easily excluding files or directories that match the given `pattern`.\n\n**Params**\n\n* `pattern` **{String}**\n* `options` **{Object}**\n\n**Example**\n\n```js\nvar gitignore = require('glob-fs-gitignore');\nvar dotfiles = require('glob-fs-dotfiles');\nvar glob = require('glob-fs')()\n  .exclude(/\\.foo$/)\n  .exclude('*.bar')\n  .exclude('*.baz');\n\nvar files = glob.readdirSync('**');\n//=> ['index.js', 'README.md', ...]\n```\n\n## Middleware\n\nglob-fs uses middleware to add file matching and exclusion capabilities, or other features that may or may not eventually become core functionality.\n\n**What is a middleware?**\n\nA middleware is a function that \"processes\" files as they're read from the file system by glob-fs.\n\nAdditionally, middleware can:\n\n* be chained\n* `include` or `exclude` a file based on some condition, like whether or not one of its properties matches a regex or glob pattern.\n* determine whether or not to continue recursing in a specific directory\n* modifying an existing property to the `file` object\n* add a new property to the `file` object\n\n### Middleware examples\n\n**Ignoring files**\n\nIn the following example, `notemp` is a complete and functional middleware for excluding any filepath that has the substring `temp`:\n\n```js\nvar glob = require('glob-fs')();\n\nfunction notemp(file) {\n  if (/temp/.test(file.path)) {\n    file.exclude = true;\n  }\n  return file;\n}\n\nglob.use(notemp)\n  .readdirStream('**/*.js')\n  .on('data', function(file) {\n    console.log(file.relative);\n  });\n```\n\n**Matching**\n\nPattern matching is done by default in glob-fs, but you get disable the built-in matchers or get more specific by adding a middleware that uses [micromatch][] or [minimatch](https://github.com/isaacs/minimatch#readme) for matching files.\n\n```js\nvar glob = require('glob-fs')({ gitignore: true });\nvar mm = require('micromatch');\n\nglob.use(function(file) {\n    if (mm.isMatch(file.relative, 'vendor/**')) file.exclude = true;\n    return file;\n  })\n  .readdirStream('**/*.js')\n  .on('data', function(file) {\n    console.log(file.relative);\n  });\n```\n\n**recursion**\n\nHere is how a middleware might determine whether or not to recurse based on a certain pattern:\n\n```js\nvar glob = require('glob-fs')();\n\n// this specific check is already done by glob-fs, it's just used here as an example \nfunction recurse(file) {\n  // `file.pattern` is an object with a `glob` (string) property\n  file.recurse = file.pattern.glob.indexOf('**') !== -1;\n  return file;\n}\n\n// use the middleware\nglob.use(recurse)\n  .readdir('**/*.js', function(err, files) {\n    console.log(files);\n  });\n```\n\n**Built-in middleware**\n\nCurrently glob-fs includes and runs the following middleware automatically:\n\n<!-- list automatically generated from deps. see .verb.md -->\n\n* [glob-fs-dotfiles](https://github.com/jonschlinkert/glob-fs-dotfiles): glob-fs middleware for automatically ignoring dotfiles.\n* [glob-fs-gitignore](https://github.com/jonschlinkert/glob-fs-gitignore): glob-fs middleware for automatically ignoring files specified in `.gitignore`\n\n**Disabling built-ins**\n\nTo disable built-in middleware and prevent them from running, pass `builtins: false` on the global options. This will disable **all built-in middleware**.\n\nExample:\n\n```js\nvar glob = require('glob-fs')({builtins: false});\n```\n\nTo disable a specific middleware from running, you can usually pass the name of the middleware on the options, like `dotfiles: false`, but it's best to check the readme of that middleware for specifics.\n\n### Middleware conventions\n\n* **Naming**: any middleware published to npm should be prefixed with `glob-fs-`, as in: `glob-fs-dotfiles`.\n* **Keywords**: please add `glob-fs` to the keywords array in package.json\n* **Options**: all middleware should return a function that takes an `options` object, as in the [Middleware Example](#middleware-example)\n* **Return `file`**: all middleware should return the `file` object after processing.\n\n### Advice for middleware authors\n\n* A middleware should only do one specific thing.\n* Multiple middleware libs can be bundled together to create a single middleware.\n* Pattern matching should be extremely specific. Don't force downstream middleware to reverse your mistakes.\n* As mentioned in the [middleware conventions](#middleware-conventions) section, **always return the `file` object**.\n* A single conditional should only set `file.exclude` to `true`, or `file.include` to `true`, never both.\n* It's completely okay to check `this.options`\n* Middleware modules should be fully documented.\n\n## Globbing examples\n\nNote that the `gitignore` option is already `true` by default, it's just shown here as a placeholder for how options may be defined.\n\n### async\n\n```js\nvar glob = require('glob-fs')({ gitignore: true });\n\nglob.readdir('**/*.js', function(err, files) {\n  console.log(files);\n});\n```\n\n### promise\n\n```js\nvar glob = require('glob-fs')({ gitignore: true });\n\nglob.readdirPromise('**/*')\n  .then(function (files) {\n    console.log(files);\n  });\n```\n\n### stream\n\n```js\nvar glob = require('glob-fs')({ gitignore: true });\n\nglob.readdirStream('**/*')\n  .on('data', function (file) {\n    console.log(file.path);\n  })\n```\n\n### sync\n\n```js\nvar glob = require('glob-fs')({ gitignore: true });\n\nvar files = glob.readdirSync('**/*.js');\nconsole.log(files);\n```\n\n## Events\n\n_(WIP)_\n\nThe following events are emitted with all \"read\" methods:\n\n* `read`: emitted immediately before an iterator calls the first middleware.\n* `include`: emits a `file` object when it's matched\n* `exclude`: emits a `file` object when it's ignored/excluded\n* `file`: emits a `file` object when the iterator pushes it into the results array. Only applies to `sync`, `async` and `promise`.\n* `dir`: emits a `file` object when the iterator finds a directory\n* `end` when the iterator is finished reading\n* `error` on errors\n\n### Event examples\n\n**async**\n\n```js\nvar glob = require('..')({ gitignore: true });\n\nglob.on('dir', function (file) {\n  console.log(file);\n});\n\nglob.readdir('**/*.js', function (err, files) {\n  if (err) return console.error(err);\n  console.log(files.length);\n});\n```\n\n**promise**\n\n```js\nvar glob = require('glob-fs')({ gitignore: true });\n\nglob.on('include', function (file) {\n  console.log('including:', file.path);\n});\n\nglob.on('exclude', function (file) {\n  console.log('excluding:', file.path);\n});\n\nglob.readdirPromise('**/*');\n```\n\n**sync**\n\nAlso has an example of a custom event, emitted from a middleware:\n\n```js\nvar glob = require('glob-fs')({ gitignore: true })\n  .use(function (file) {\n    if (/\\.js$/.test(file.path)) {\n      // custom event\n      this.emit('js', file);\n    }\n    return file;\n  });\n\nglob.on('js', function (file) {\n  console.log('js file:', file.path);\n});\n\nglob.on('exclude', function (file) {\n  console.log('excluded:', i.excludes++);\n});\n\nglob.on('include', function (file) {\n  console.log('included:', i.includes++)\n});\n\nglob.on('end', function () {\n  console.log('total files:', this.files.length);\n});\n\nglob.readdirSync('**/*.js');\n```\n\n**stream**\n\n```js\nvar glob = require('glob-fs')({ gitignore: true })\n\nglob.readdirStream('**/*')\n  .on('data', function (file) {\n    console.log(file.path)\n  })\n  .on('error', console.error)\n  .on('end', function () {\n    console.log('end');\n  });\n```\n\n## FAQ\n\n* when files are read from the file system, an object is created to keep a record of the file's `path`, `dirname`, and fs `stat` object and other pertinent information that makes it easier to make decisions about inclusion and exclusion later on.\n* `file` objects are decorated with a `parse` method that is used to calculate the `file.relative` and `file.absolute` properties.\n* the `file.parse()` method is called in the iterator, right after the call to `  fs.stats` and just before the call to the middleware handler (`.handle()`). This ensures that all middleware have access to necessary path information.\n* `file.relative` is the file path that's actually pushed into the `files` array that is ultimately returned.\n* `file.relative` is calculated using `path.relative(file.path, cwd)`, where `cwd` is passed on the options (globally, or on a middleware), and `file.path` is typically the absolute, actual file path to the file being globbed.\n\n## TODO\n\n**middleware**\n\n* [x] middleware\n* [x] middleware handler\n* [ ] externalize middleware to modules (started, [prs welcome!](#contributing))\n\n**events**\n\n* [x] events\n\n**tests**\n\n* [x] unit tests (need to be moved)\n\n**iterators**\n\n* [x] sync iterator\n* [x] async iterator\n* [x] stream iterator\n* [x] promise iterator\n\n**read methods**\n\n* [x] glob.readdir (async)\n* [x] glob.readdirSync\n* [x] glob.readdirStream\n* [x] glob.readdirPromise\n\n**patterns**\n\n* [ ] Multiple pattern support. will need to change pattern handling, middleware handling. this is POC currently\n* [ ] Negation patterns (might not do this, since it can be handled in middleware)\n* [ ] matching method, memoized/cached/bound to a glob pattern or patterns, so it can be reused without having to recompile the regex.\n\n**other**\n\n* [ ] clean up `./lib`\n* [ ] comparsion to [node-glob][]\n\n## Community middleware\n\n_(Add your project to the [.verb.md](./.verb.md) template do a PR!)_\n\n<!-- remove these after we get some community middleware libs listed -->\n\n* [glob-fs-dotfiles](https://github.com/jonschlinkert/glob-fs-dotfiles): glob-fs middleware for automatically ignoring dotfiles.\n* [glob-fs-gitignore](https://github.com/jonschlinkert/glob-fs-gitignore): glob-fs middleware for automatically ignoring files specified in `.gitignore`\n\n## Related projects\n\n* [braces](https://github.com/jonschlinkert/braces): Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces… [more](https://github.com/jonschlinkert/braces)\n* [fill-range](https://github.com/jonschlinkert/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier to… [more](https://github.com/jonschlinkert/fill-range)\n* [is-glob](https://github.com/jonschlinkert/is-glob): Returns `true` if the given string looks like a glob pattern.\n* [micromatch](https://github.com/jonschlinkert/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://github.com/jonschlinkert/micromatch)\n\n## Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm i -d && npm test\n```\n\n## Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/glob-fs/issues/new)\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\n\nCopyright © 2015 Jon Schlinkert\nReleased under the MIT license.\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 11, 2015._","maintainers":[{"email":"brian.woodward@gmail.com","name":"doowb"},{"email":"github@sellside.com","name":"jonschlinkert"}],"time":{"modified":"2022-06-18T12:53:53.812Z","created":"2015-07-07T19:44:11.305Z","0.1.0":"2015-07-07T19:44:11.305Z","0.1.2":"2015-07-09T05:47:44.646Z","0.1.3":"2015-07-09T06:08:06.902Z","0.1.5":"2015-07-09T20:18:39.243Z","0.1.6":"2015-07-12T01:35:27.448Z","0.1.7":"2017-07-20T15:14:44.510Z"},"homepage":"https://github.com/jonschlinkert/glob-fs","keywords":["file","fs","glob","match","path"],"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/glob-fs.git"},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"bugs":{"url":"https://github.com/jonschlinkert/glob-fs/issues"},"license":"MIT","readmeFilename":"README.md","users":{"dgautsch":true,"royston":true,"dzikoysk":true,"usex":true}}