JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3834821
  • Score
    100M100P100Q212359F
  • License ISC

Promise version of glob

Package Exports

  • glob-promise

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (glob-promise) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

glob-promise version License

Promise version of glob:

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

Build Status Downloads Code Climate Coverage Status Dependency Status Dependencies

Install

npm install --only=production --save glob-promise

Usage

I recommend using an optimized build matching your Node.js environment version, otherwise, the standard require would work just fine with any version of Node >= v4.0 .

/*
 * Node 7
 */
const glob = require('glob-promise/lib/node7')

/*
 * Node 6
 */
const glob = require('glob-promise/lib/node6')

/*
 * Node 4 (Default)
 * Note: additional ES2015 polyfills may be required
 */
var glob = require('glob-promise')

API

glob(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.

glob('**/*')
  .then(function(contents) {
    contents; //=> ['lorem', 'ipsum', 'dolor']
  });

glob('{foo,bar.baz}.txt', { nobrace: true })
  .then(function(contents) {
    contents; //=> []
  });

options

The option object will be directly passed to glob.


©️ ahmadnassri.com  ·  License: ISC  ·  Github: @ahmadnassri  ·  Twitter: @ahmadnassri