Socket
Book a DemoInstallSign in
Socket

@open-tech-world/node-glob

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@open-tech-world/node-glob

Match files & directories using glob patterns.

latest
Source
npmnpm
Version
0.4.0
Version published
Maintainers
1
Created
Source

@open-tech-world/node-glob

Linux Build Windows Build macOS Build CodeFactor npm

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?: Partial<IOptions>): string[];

Options

NameTypeDefaultDescription
cwdstringprocess.cwd()The current working directory in which to search files & folders.
dotbooleanfalseIf true, it matches files & directories that begin with a "."(dot) character.
absolutebooleanfalseIf true, it returns the absolute path.
dirsbooleantrueIf false, it does not include directories.
filesbooleantrueIf false, it does not include files.

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(['*']) // ['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 (MIT License).

Keywords

match

FAQs

Package last updated on 11 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts