Lightning-fast rm alternative powered by Bun
rq is a drop-in replacement for rm that's 2-4x faster. Built with Bun and optimized for parallel I/O operations.
# Instead of: rm -rf node_modules
rq -rf node_modules # 2-4x faster!| Scenario | rm |
rq |
Speedup |
|---|---|---|---|
Delete node_modules (10k files) |
17.9s | 7.5s | 2.4x |
| Deep nested directories | 50ms | 13ms | 3.9x |
| Bulk file deletion | 860ms | 382ms | 2.3x |
# With bun (recommended)
bun install -g rq-rm
# With npm
npm install -g rq-rmrq is fully compatible with rm. Just replace rm with rq:
# Delete files
rq file.txt
rq file1.txt file2.txt file3.txt
# Delete directories (recursive)
rq -r directory/
rq -rf node_modules/ # Force + recursive
# Verbose mode
rq -rv build/ # See what's being deleted
# Interactive mode
rq -i important.txt # Prompt before deletion| Flag | Long Form | Description |
|---|---|---|
-f |
--force |
Ignore nonexistent files, never prompt |
-r |
--recursive |
Remove directories and their contents |
-R |
Same as -r |
|
-d |
--dir |
Remove empty directories |
-v |
--verbose |
Explain what is being done |
-i |
Prompt before every removal | |
-I |
Prompt once before removing >3 files | |
-x |
--one-file-system |
Stay on one file system |
--preserve-root |
Do not remove / (default) |
|
--no-preserve-root |
Allow removing / |
|
--help |
Display help | |
--version |
Display version |
Tested on macOS with SSD storage:
============================================================
BENCHMARK RESULTS
============================================================
| Test | rm (ms) | rq (ms) | Speedup |
|-----------------------------|----------|----------|---------|
| small (30 files) | 4.09 | 1.36 | 3.01x |
| medium (620 files) | 53.91 | 25.54 | 2.11x |
| large (10k files, nested) | 17961.89 | 7490.67 | 2.40x |
| flat-10k | 860.10 | 382.04 | 2.25x |
| flat-50k | 5527.96 | 3573.26 | 1.55x |
| deep (200 files, 20 levels) | 49.89 | 12.80 | 3.90x |
| wide (15.5k files) | 1280.38 | 544.74 | 2.35x |
Overall Average Speedup: 2.51x
Run benchmarks yourself:
bun run benchmark- Parallel I/O: Files are deleted concurrently using
Promise.all(), saturating disk I/O bandwidth - Sync Traversal: Directory tree is walked synchronously to minimize Promise overhead
- Bun Native: Leverages Bun's optimized filesystem APIs for maximum performance
- Zero Dependencies: No external dependencies, just pure Bun
# Clone the repo
git clone https://github.com/tryosschat/rq.git
cd rq
# Install dependencies
bun install
# Run tests
bun test
# Run benchmarks
bun run benchmarkContributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE for details.
Made with ⚡ by tryosschat