Promise version of glob
Match files using the patterns the shell uses, like stars and stuff.!licenselicense-imglicense-url !releaserelease-imgrelease-url !semanticsemantic-imgsemantic-url
Note: This is just aPromise
wrapped version ofglob
Install
npm install glob-promise glob
NOTE
glob
is set as a peerDependency
in package.json
npm
\>= 7 will automatically installpeerDependencies
npm
\<= 6 will not automatically installpeerDependencies
.
You will need to manually add
glob
as a dependency to your project for glob-promise
to work.API
glob(pattern [, options])
Alias for glob.promise
glob.promise(pattern [, options])
pattern: String
(glob pattern)
options: Object
or String
Return: Object
(PromisePromise
)When it finishes, it will be fulfilled with an
Array
of filenames as its first argument.When it fails to read the files, it will be rejected with an error as its first argument.
glob('**/*')
.then(function(contents) {
contents; //=> ['lorem', 'ipsum', 'dolor']
});
glob('{foo,bar.baz}.txt', { nobrace: true })
.then(function(contents) {
contents; //=> []
});
glob.glob(pattern [, options], cb)
see glob
1
glob.sync(pattern [, options])
see glob.sync()
glob.hasMagic(pattern, [options])
see glob.hasMagic()
Class: glob.Glob
see Glob
2
options
The option object will be directly passed to glob.Promise
: http://promisesaplus.com/
glob
: https://github.com/isaacs/node-glob
package.json
: package.json
fulfilled: http://promisesaplus.com/#point-26
rejected: http://promisesaplus.com/#point-30
1: https://github.com/isaacs/node-glob#globpattern-options-cb
glob.sync()
: https://github.com/isaacs/node-glob#globsyncpattern-options
glob.hasMagic()
: https://github.com/isaacs/node-glob#globhasmagicpattern-options
2: https://github.com/isaacs/node-glob#class-globglob
glob: https://github.com/isaacs/node-glob#optionsAuthor: Ahmad Nassri • Twitter: @AhmadNassri