node-glob-promise

A Promise-based wrapper around the classic glob file-matching library for Node.js.

Library
npm
v6.0.7
54stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
36/100Needs Attention
Development Activity12
Maintenance20
Community40
Maturity60
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
50/100Fair
Architecture60
Code Quality58
Innovation38
Learning Curve45

glob-promise wraps the classic node-glob callback API in native Promises, letting you await file-pattern matches with no manual callback code in Node.js. It re-exports the underlying glob module’s utilities unchanged, so existing glob-based code can adopt it as a near drop-in replacement while gaining async/await ergonomics.

What You Get

  • A default export that is itself the Promise-returning glob function — call it directly with a pattern and options.
  • Direct re-exports of .glob, .Glob, .hasMagic, and .sync from the underlying glob package for parity with existing code.
  • Bundled TypeScript ambient declarations (lib/index.d.ts) with no separate @types install required.
  • A small, dependency-light install — glob itself is a peerDependency, not a bundled dependency.

Common Use Cases

  • Collecting source files for a build or bundling step before compilation.
  • Migrating a callback-heavy Node.js codebase to async/await incrementally.
  • Resolving user-supplied glob patterns in CLI tools without hand-rolled Promise wrapping.

Under The Hood

Architecture The package is a single-file module (lib/index.js) that defines one promise function wrapping node-glob’s callback signature in a new Promise((resolve, reject) => ...), then attaches the underlying glob module’s own utilities (.glob, .Glob, .hasMagic, .sync) as read-only properties on the exported function. There is no internal layering or abstraction beyond this single adapter — the entire data flow is call in, callback wrapped, promise resolved or rejected — which keeps the surface area intentionally trivial for what is a thin compatibility shim rather than a standalone system.

Tech Stack The runtime footprint is effectively zero: glob is declared only as a peerDependency (pinned to ^8.0.3), so the package ships no bundled logic of its own beyond the wrapper. Dev tooling consists of tap for testing and @types/glob for type references, with a hand-authored lib/index.d.ts using CommonJS export = interop rather than a compiled TypeScript build. CI, linting, and release automation are inherited from the maintainer’s shared ahmadnassri/actions reusable GitHub Actions workflows and a template-node-lib scaffold, with semantic-release handling publishing and a Makefile driving local tasks.

Code Quality test/index.js uses tap’s plan-based assertions to cover the exported shape (all utility properties are functions), a successful pattern match, a rejected promise on glob failure, and type-error behavior when called with an invalid or missing pattern argument. Errors from the underlying glob callback are passed straight through to the promise rejection rather than being swallowed or rewrapped. No local lint configuration is visible in the repository itself (linting appears to be handled by the shared reusable workflow rather than a project-local eslint config), and the source is plain untyped JavaScript with only hand-written ambient declarations providing TypeScript support.

API Design The library’s whole value proposition is a near-zero migration cost: the default export is the promise-returning function itself, called exactly like the original glob’s synchronous pattern argument, while .glob, .Glob, .hasMagic, and .sync mirror the underlying glob package’s own shape so callers already familiar with glob need no new mental model. The maintainer’s README candidly notes that glob v9+ now has native Promise support and recommends switching to it directly, which is an unusually transparent acknowledgment that this adapter’s own reason for existing is fading as its dependency absorbs the same capability.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search