1. glob-promise
Promise version of glob
glob-promise
Package: glob-promise
Created by: ahmadnassri
Last modified: Sun, 03 Sep 2023 15:35:21 GMT
Version: 6.0.5
License: MIT
Downloads: 14,544,281
Repository: https://github.com/ahmadnassri/node-glob-promise

Install

npm install glob-promise
yarn add glob-promise

Promise version of glob

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

license
release
semantic

Note: This is just a Promise wrapped version of glob

Install

 npm install glob-promise glob
NOTE

glob is set as a peerDependency in package.json

  • npm >= 7 will automatically install peerDependencies
  • npm <= 6 will not automatically install peerDependencies.

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 (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; //=> []
  });

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

options

The option object will be directly passed to glob.


Author: Ahmad Nassri •
Twitter: @AhmadNassri

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code