1 # globby [![Build Status](https://travis-ci.org/sindresorhus/globby.svg?branch=master)](https://travis-ci.org/sindresorhus/globby)
3 > Extends [glob](https://github.com/isaacs/node-glob) with support for multiple patterns and exposes a Promise API
9 $ npm install --save globby
22 const globby = require('globby');
24 globby(['*', '!cake']).then(paths => {
26 //=> ['unicorn', 'rainbow']
33 ### globby(patterns, [options])
35 Returns a Promise for an array of matching paths.
37 ### globby.sync(patterns, [options])
39 Returns an array of matching paths.
41 ### globby.generateGlobTasks(patterns, [options])
43 Returns an array of objects in the format `{ pattern: string, opts: Object }`, which can be passed as arguments to [`node-glob`](https://github.com/isaacs/node-glob). This is useful for other globbing-related packages.
45 Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.
47 ### globby.hasMagic(patterns, [options])
49 Returns a `boolean` of whether there are any special glob characters in the `patterns`.
51 Note that the options affect the results. If `noext: true` is set, then `+(a|b)` will not be considered a magic pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`, then that is considered magical, unless `nobrace: true` is set.
55 Type: `string` `Array`
57 See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage).
63 See the `node-glob` [options](https://github.com/isaacs/node-glob#options).
68 Just a quick overview.
70 - `*` matches any number of characters, but not `/`
71 - `?` matches a single character, but not `/`
72 - `**` matches any number of characters, including `/`, as long as it's the only thing in a path part
73 - `{}` allows for a comma-separated list of "or" expressions
74 - `!` at the beginning of a pattern will negate the match
76 [Various patterns and expected matches.](https://github.com/sindresorhus/multimatch/blob/master/test.js)
81 - [multimatch](https://github.com/sindresorhus/multimatch) - Match against a list instead of the filesystem
82 - [glob-stream](https://github.com/wearefractal/glob-stream) - Streaming alternative
83 - [matcher](https://github.com/sindresorhus/matcher) - Simple wildcard matching
88 MIT © [Sindre Sorhus](https://sindresorhus.com)