del

Delete files and directories using glob patterns, with a safe promise-based API.

Library
npm
v8.0.1
1,343 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
70 /100 Good
Development Activity 76
Maintenance 56
Community 60
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
73 /100 Good
Architecture 70
Code Quality 85
Innovation 50
Learning Curve 85

del is a small, focused Node.js library for deleting files and directories using glob patterns. It wraps globby for pattern matching and Node’s native fs.rm under the hood, exposing both a promise-based deleteAsync and a synchronous deleteSync API, each returning the list of paths actually removed.

Unlike a bare rm -rf or rimraf call, del builds in safety checks by default: it refuses to delete the current working directory or anything outside it unless you explicitly pass force: true. It also supports a dryRun mode for previewing what would be deleted, a per-file onProgress callback for reporting deletion progress, and a concurrency option for tuning how many deletions run in parallel.

What You Get

  • deleteAsync and deleteSync functions that return the actual list of deleted paths
  • Built-in safety checks that block deleting the cwd or paths outside it unless force is set
  • dryRun mode to preview exactly what a pattern would delete before running it
  • An onProgress callback reporting totalCount/deletedCount/percent as files are removed
  • A concurrency option to control how many deletions run in parallel

Common Use Cases

  • Clearing a dist/ or build/ output directory before a fresh build step
  • Cleaning up temporary files created during a test run or CI job
  • Removing generated cache or coverage folders as part of a clean script
  • Pruning old log or temp files matched by a glob pattern on a schedule

Under The Hood

Architecture The entire package is one flat ES module (index.js) exporting deleteAsync and deleteSync, both built on two small shared helpers: normalizePatterns (Windows path handling via slash and is-glob) and safeCheck (guards against deleting the cwd or paths outside it via is-path-cwd and is-path-inside, throwing a PresentableError). There is no class hierarchy or plugin system — the async path resolves patterns through globby then maps deletions concurrently with p-map, while the sync path mirrors the same logic with globbySync and fs.rmSync. Deleted paths are sorted for deterministic output. It’s a deliberately thin, single-responsibility module rather than a layered system, so there’s little architectural surface to break.

Tech Stack Targets Node.js >=18 and ships as pure ESM (“type”: “module”) with a dual types/default export map and sideEffects:false for tree-shaking. Runtime dependencies are all small sindresorhus utilities: globby (pattern matching), is-glob, is-path-cwd, is-path-inside, p-map (concurrency-limited mapping), slash (path normalization), and presentable-error for user-facing error messages. Dev tooling is xo (a strict opinionated ESLint config) for linting, ava for tests, tsd for type-level testing, and tempy for isolated temp directories in tests.

Code Quality test.js contains an extensive AVA suite covering both the async and sync APIs in parallel: default behavior, dot-file matching, dry-run output, progress callbacks, absolute vs relative paths outside cwd, Windows-style backslash paths, and a dedicated regression test for an EINVAL race condition run 200 times. Type correctness is checked separately via tsd against index.test-d.ts. CI (.github/workflows/main.yml) runs the full suite across Node 18/20/22 on Ubuntu, macOS, and Windows, and the xo linter is part of the npm test script itself, so nothing merges without passing lint, tests, and type checks.

What Makes It Unique del isn’t trying to out-feature rimraf — its distinguishing choice is defaulting to safety: any attempt to delete the current working directory or a path outside it throws immediately unless the caller opts in with force: true, which prevents an entire class of “deleted my whole project” accidents that plain rm -rf/rimraf usage is prone to. Combined with dryRun and onProgress, it’s built for tooling authors who need predictable, inspectable deletion rather than raw speed.

Used by 6 apps in this directory

Python
47%
Other

Airbyte

Data Engineering · Developer Tools

22,143

Open-source ELT platform with 600+ connectors for moving data from any source to warehouses, lakes, and AI agents.

View details
95
Repo Health
80
Technical
67
Dependency
Built with
Python 47%
Kotlin 43%
Updated 4 days ago
TypeScript
91%
Other

browserless

Automation · Developer Tools

13,746

Run headless Chrome, Firefox, and WebKit as a managed Docker service — drop-in Puppeteer and Playwright support with no infrastructure overhead.

View details
84
Repo Health
82
Technical
73
Dependency
Built with
TypeScript 91%
Updated 6 days ago
C++
53%
Other

Cocos Engine

Design Tools · Developer Tools · Game Development

9,832

Open-source, cross-platform 2D/3D game engine with Vulkan, Metal, and WebGL support for web, mobile, and instant gaming platforms

View details
89
Repo Health
79
Technical
70
Dependency
Built with
C++ 53%
TypeScript 34%
Updated 1 weeks ago
TypeScript
98%
Other

Kibana

Analytics · Monitoring

21,301

Your open source window into the Elastic Stack — query, visualize, and act on data stored in Elasticsearch with real-time dashboards, AI-assisted search, and automated alerting.

View details
98
Repo Health
87
Technical
63
Dependency
Built with
TypeScript 98%
Updated 4 days ago
TypeScript
99%
MIT

Umami

Analytics

39,052

Privacy-first web analytics that respects your users — self-hosted, cookieless, and GDPR compliant out of the box.

View details
94
Repo Health
83
Technical
67
Dependency
Built with
TypeScript 99%
Updated 6 days ago
TypeScript
85%
Other

Webiny JS

Blogging · CMS · Ecommerce

8,048

Open-source, self-hosted CMS on AWS serverless — a TypeScript framework you extend with code, not a product you configure through a UI.

View details
90
Repo Health
86
Technical
62
Dependency
Built with
TypeScript 85%
JavaScript 13%
Updated 5 days ago

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