Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including glob-promise with all npm packages installed. Try it out:

require("glob/package.json"); // glob is a peer dependency. var globPromise = require("glob-promise")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

glob-promise v3.4.0

Promise version of glob

glob-promise version License Build Status Downloads Coverage Status

Promise version of glob

Match files using the patterns the shell uses, like stars and stuff.


# using yarn
$ yarn add glob-promise

# using npm
$ npm install --production --save glob-promise

glob is set as a peerDependency in package.json

  • npm <= 2 will automatically install peerDependencies if they are not explicitly depended upon higher in the dependency tree.
  • npm >= 3 will no longer automatically install peerDependencies.

You will need to manually add glob as a dependency to your project for glob-promise to work.


glob(pattern [, options])

Alias for glob.promise

glob.promise(pattern [, options])

pattern: String (glob pattern) options: Object or String Return: Object (Promise)

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.

  .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

glob.sync(pattern [, options])

see glob.sync()

glob.hasMagic(pattern, [options])

see glob.hasMagic()

Class: glob.Glob

see Glob


The option object will be directly passed to glob.

License: ISC • Copyright: • Github: @ahmadnassri • Twitter: @ahmadnassri

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free