rimraf

Cross-platform recursive file and directory removal for Node.js, modeled on the UNIX `rm -rf` command.

Library
npm
v6.1.3
5,855 stars
BlueOak-1.0.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
41 /100 Fair
Development Activity 8
Maintenance 0
Community 56
Maturity 60
Momentum 40

Technical Analysis

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

rimraf is a small, battle-tested Node.js module that recursively deletes files and directories, providing a reliable cross-platform equivalent to the UNIX rm -rf command. It ships both a programmatic API (rimraf, rimrafSync, and platform-specific strategies like native, windows, and moveRemove) and a CLI binary, and automatically selects the fastest safe implementation for the current Node.js version and operating system.

Because deleting files reliably across Windows, macOS, and Linux involves subtle edge cases (locked files, EBUSY/EPERM errors, non-atomic unlink/rmdir calls), rimraf has become a de-facto standard dependency in build tools, test harnesses, and CLI utilities that need to clean up directories without reinventing platform-specific retry and fallback logic.

What You Get

  • Async and sync APIs (rimraf, rimrafSync) that resolve to a boolean success value
  • Multiple removal strategies (native, windows, manual, posix, moveRemove) selectable per platform or forced explicitly
  • A CLI binary supporting glob patterns, verbose output, interactive confirmation, and configurable retry/backoff
  • An AbortSignal-aware API for cancelling long-running directory removals
  • A filter option to selectively exclude paths from deletion while still recursing into their children

Common Use Cases

  • Cleaning build output directories (dist/, build/) before a fresh compile
  • Removing temporary test fixtures and scratch directories between test runs
  • Deleting node_modules or cache directories as part of a reset/clean npm script
  • Deleting arbitrary glob-matched paths from a CLI or CI pipeline step

Under The Hood

Architecture rimraf is organized around a shared wrap/wrapSync higher-order function (src/index.ts) that normalizes single-path and array-of-paths inputs, resolves glob patterns via the glob package, and dispatches to one of five interchangeable removal strategies (native, posix, windows, manual, moveRemove), each implemented in its own module (rimraf-native.ts, rimraf-posix.ts, rimraf-windows.ts, rimraf-manual.ts, rimraf-move-remove.ts). use-native.ts decides at call time whether the built-in fs.rm can be used, falling back to the JS-implemented Windows/POSIX strategies when a filter or signal option is supplied, since Node’s native implementation doesn’t support those.

Tech Stack The project is TypeScript-first, built with tshy to emit dual ESM/CommonJS output, targets Node 20 or >=22, and depends on only two runtime packages (glob and package-json-from-dist). Testing uses tap with recorded snapshots in tap-snapshots/, linting uses oxlint, and docs are generated via typedoc.

Code Quality The test/ directory mirrors src/ one-to-one (17 files) plus an integration/ suite, with dedicated coverage for edge cases like EPERM handling (fix-eperm.ts) and ENOENT-safe readdir (ignore-enoent.ts). Modules are small and single-purpose, options parsing/validation is centralized in opt-arg.ts rather than duplicated per-strategy, and the codebase carries no any-typed escape hatches in the reviewed entry points.

API Design The public surface is intentionally narrow: rimraf/rimrafSync cover the common case, with named exports (native, windows, manual, posix, moveRemove) available for callers who need to force a specific strategy. All removal functions return a plain boolean rather than throwing on partial removal, and the CLI mirrors the same option set (--glob, --impl, --preserve-root), keeping the library and CLI mental models consistent.

Used by 87 apps in this directory

TypeScript
96%
Other

Refly

AI Development · Automation · No Code Platforms

7,537

Build deterministic, versioned agent skills from natural language—run them anywhere from Claude Code to Slack.

View details
68
Repo Health
76
Technical
63
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
TypeScript
97%
AGPL 3.0

Responsively App

Design Tools · Developer Tools

25,464

Preview and interact with your responsive web design across every device size simultaneously — no more manual resizing.

View details
79
Repo Health
71
Technical
66
Dependency
Built with
TypeScript 97%
Updated 3 weeks ago
TypeScript
97%
Other

Rocket.Chat

Team Chat

46,304

The secure, self-hosted team communications platform for organizations that cannot compromise on data sovereignty.

View details
96
Repo Health
79
Technical
63
Dependency
Built with
TypeScript 97%
Updated 6 days ago
TypeScript
99%
MIT

Sanity

CMS

6,370

Open-source headless CMS with a fully customizable React Studio, real-time collaborative editing, structured content modeling, and GROQ query language

View details
92
Repo Health
90
Technical
66
Dependency
Built with
TypeScript 99%
Updated 6 days ago
TypeScript
61%
AGPL 3.0

Silex

Design Tools · No Code Platforms

3,015

Free, open-source visual website builder that exports clean HTML/CSS — no lock-in, no subscription, host anywhere

View details
89
Repo Health
68
Technical
67
Dependency
Built with
TypeScript 61%
Rust 15%
JavaScript 11%
Updated 1 weeks ago
TypeScript
89%
Other

Hexclave

Authentication · Developer Tools

6,877

The open-source user infrastructure platform — authentication, teams, payments, emails, analytics, and more on a single unified user model.

View details
88
Repo Health
80
Technical
66
Dependency
Built with
TypeScript 89%
Updated 6 days ago
TypeScript
83%
AGPL 3.0

Standard Notes

Note Taking

6,681

End-to-end encrypted notes and files — private by design, built to last, and fully self-hostable.

View details
89
Repo Health
83
Technical
68
Dependency
Built with
TypeScript 83%
JavaScript 14%
Updated 1 weeks ago
TypeScript
89%
Other

strapi

CMS

73,368

Open-source headless CMS that auto-generates REST and GraphQL APIs from your content models, with a fully customizable admin panel you control.

View details
93
Repo Health
84
Technical
63
Dependency
Built with
TypeScript 89%
JavaScript 11%
Updated 1 weeks ago
TypeScript
72%
Apache 2.0

Supabase

Authentication · Databases · Developer Tools

113,827

The open-source Postgres development platform that replaces Firebase with authentication, real-time APIs, edge functions, storage, and vector embeddings — all built on PostgreSQL.

View details
90
Repo Health
91
Technical
62
Dependency
Built with
TypeScript 72%
MDX 26%
Updated 6 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