# @open-tech-world/node-glob

> Match files & directories using glob patterns.

Latest version **0.4.0** (published 2021-08-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @open-tech-world/node-glob
pnpm add @open-tech-world/node-glob
yarn add @open-tech-world/node-glob
bun add @open-tech-world/node-glob
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2021-08-11 |
| First published | 2021-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^12.22.0 \|\| ^14.17.0 \|\| >=16.0.0 |
| Dependencies | 2 |
| Unpacked size | 17.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Thanga Ganapathy |
| Maintainers | ganapathy |
| Keywords | match, file, files, folders, dir, directories, glob, pattern, node |

## Links

- npm: https://www.npmjs.com/package/@open-tech-world/node-glob
- Repository: https://github.com/open-tech-world/node-glob
- Homepage: https://github.com/open-tech-world/node-glob#readme
- Issues: https://github.com/open-tech-world/node-glob/issues
- npm.io page: https://npm.io/package/@open-tech-world/node-glob

## Dependencies (2)

- [@open-tech-world/es-glob](https://npm.io/package/@open-tech-world/es-glob.md) ^0.8.1
- [@open-tech-world/es-utils](https://npm.io/package/@open-tech-world/es-utils.md) ^0.8.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.4.0 (latest) — 2021-08-11
- 0.3.0 — 2021-08-05
- 0.2.1 — 2021-07-31
- 0.2.0 — 2021-07-31
- 0.1.1 — 2021-07-31
- 0.1.0 — 2021-07-31

## README

<div align="center">

# @open-tech-world/node-glob
[![Linux Build](https://github.com/open-tech-world/node-glob/actions/workflows/linux_build.yml/badge.svg)](https://github.com/open-tech-world/node-glob/actions/workflows/linux_build.yml) [![Windows Build](https://github.com/open-tech-world/node-glob/actions/workflows/windows_build.yml/badge.svg)](https://github.com/open-tech-world/node-glob/actions/workflows/windows_build.yml) [![macOS Build](https://github.com/open-tech-world/node-glob/actions/workflows/macos_build.yml/badge.svg)](https://github.com/open-tech-world/node-glob/actions/workflows/macos_build.yml) [![CodeFactor](https://www.codefactor.io/repository/github/open-tech-world/node-glob/badge)](https://www.codefactor.io/repository/github/open-tech-world/node-glob) ![npm](https://img.shields.io/npm/v/@open-tech-world/node-glob?color=blue)
</div>

> Match files & directories using [glob](https://en.wikipedia.org/wiki/Glob_(programming)) patterns.

It uses [@open-tech-worl/es-glob](https://github.com/open-tech-world/es-glob) for matching paths.

See the list of supported glob patterns [here](https://github.com/open-tech-world/es-glob#supported-glob-patterns).

## Features

✔️ Sync Matching API

🚧 Async Matching API

✔️ Supports Multiple Patterns

## Installation

Using npm

```shell
npm install @open-tech-world/node-glob
```

Using Yarn

```shell
yarn add @open-tech-world/node-glob
```

## Usage

```ts
import { globSync } from '@open-tech-world/node-glob';

globSync(patterns: string | string[], 
         options?: Partial<IOptions>): string[];
```

#### Options

| Name | Type | Default | Description |
|------|------|---------|------|
| 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.|
| absolute  | boolean | false | If true, it returns the absolute path.|
| dirs  | boolean | true | If false, it does not include directories.|
| files  | boolean | true | If false, it does not include files.|

## Examples

```shell
my-app/
├─ node_modules/
├─ public/
│  ├─ favicon.ico
│  ├─ index.html
│  ├─ robots.txt
├─ src/
│  ├─ index.css
│  ├─ index.js
├─ .gitignore
├─ package.json
├─ README.md
```
```ts
import { globSync } from '@open-tech-world/node-glob';

globSync(['*']) // ['node_modules', 'public', 'src', 'package.json', 'README.md']

globSync(['*'], { dot: true }) // ['node_modules', 'public', 'src', '.gitignore', 'package.json', 'README.md']

globSync(['*', '!node_modules']) // ['public', 'src', 'package.json', 'README.md']

globSync(['*.json']) // ['package.json']

globSync(['src/index.*']) // ['src/index.css', 'src/index.js']

globSync(['**/index.[a-j]*']) // ['src/index.css', 'src/index.js']

globSync(['public/*.(html|ico)']) // ['public/index.html', 'public/favicon.ico']
```

## License

Copyright (c) 2021, [Thanga Ganapathy](https://thanga-ganapathy.github.io) ([MIT License](./LICENSE)).

---
_Source: https://npm.io/package/@open-tech-world/node-glob · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
