doglob
v0.0.2
Published
Mini utility to recursively find files using glob patterns
Maintainers
Readme
DoGlob
Match files with patterns. CLI & API.
DoGlob — a lightweight utility to glob files based on patterns, with support for ignores, .gitignore, dotfiles, and JSON output.
Features ✨
- 🔹 Flexible API:
mg(patterns, options)in Node.js/TypeScript. - 🚀 CLI ready: Run from terminal with
--jsonoutput support. - 🔄 Positive & negative patterns: Include/exclude files easily.
- 🌐 Cross-environment — works in modern Node.js versions.
- ⚡ Fast & minimal — pure TypeScript/JS implementation.
Installation 💿
# Using npm
npm install doglob
# Using pnpm
pnpm add doglob
# Using yarn
yarn add doglobUsage 📦
API </>
import { doGlob } from 'doglob';
const files = await doGlob(['src/**/*.ts', '!**/*.test.ts'], {
projectRoot: 'src',
onlyFiles: true,
dot: true,
});
console.log(files);CLI 🖥️
#!/usr/bin/env node
doglob [options] <patterns...>Example Commands
# Match all .ts files
doglob 'src/**/*.ts'
# Match and exclude tests
doglob 'src/**/*.ts' '!**/*.test.ts'
# Output as JSON
doglob 'src/**/*.ts' --json
# Include hidden files
doglob 'src/**/*' --dot
# Ignore a pattern
doglob 'src/**/*' --ignore 'node_modules/**'CLI Options
--project-root <path> Project root directory
--ignore <pattern> Pattern to ignore (can be used multiple times)
--ignore-case Ignore case
--no-gitignore Disable .gitignore usage
--only-files Only files, exclude directories
--dot Include hidden files
--follow-symlinks Follow symbolic links
--json Output in JSON format
--help Show this helpLicense 📄
MIT License – see LICENSE for details.
Author: Estarlin R (estarlincito.com)
