Match files & directories using glob patterns.
It uses @open-tech-worl/es-glob for matching paths.
See the list of supported glob patterns here.
Features
✔️ Sync Matching API
🚧 Async Matching API
✔️ Supports Multiple Patterns
Installation
Using npm
npm install @open-tech-world/node-glob
Using Yarn
yarn add @open-tech-world/node-glob
Usage
import { globSync } from '@open-tech-world/node-glob';
globSync(patterns: string | string[], options: IOptions): string[];
Options
| cwd | string | process.cwd() | The current working directory in which to search files & folders. |
| dot | boolean | false | If true, it matches files & directories that begin with a .(dot) character. |
Examples
my-app/
├─ node_modules/
├─ public/
│ ├─ favicon.ico
│ ├─ index.html
│ ├─ robots.txt
├─ src/
│ ├─ index.css
│ ├─ index.js
├─ .gitignore
├─ package.json
├─ README.md
import { globSync } from '@open-tech-world/node-glob';
globSync(['*'])
globSync(['*'], { dot: true })
globSync(['*', '!node_modules'])
globSync(['*.json'])
globSync(['src/index.*'])
globSync(['**/index.[a-j]*'])
globSync(['public/*.(html|ico)'])
License
Copyright (c) 2021, Thanga Ganapathy (MIT License).