Skip to Content
APIrm

rm

This page describes @vooya/fs@0.1.1. See Node compatibility and execution policy for native fast paths, Node routes and verified limits.

Remove files and directories. Supports recursive removal with optional concurrency (Vooya FS extension) for tuning recursive deletion.

Basic usage

import { rm } from '@vooya/fs' // Remove a file await rm('./tmp.txt') // Remove a directory recursively await rm('./temp-dir', { recursive: true }) // Force (ignore errors when path does not exist) + retries await rm('./maybe-missing', { recursive: true, force: true, maxRetries: 3 }) // Recursive with explicit concurrency (measure for your workload) await rm('./large-tree', { recursive: true, force: true, concurrency: 4 })

Methods

rm(path, options?)

Async. Returns Promise<void>.

ArgumentTypeDescription
pathstring / Buffer / URLPath to file or directory.
optionsobjectOptional. See below.

Options:

OptionTypeDefaultDescription
forcebooleanfalseIf true, ignore ENOENT (path not found).
maxRetriesnumber0Retry on transient errors (e.g. Windows locking).
recursivebooleanfalseIf true, remove directory and its contents.
retryDelaynumber100Base delay in ms; retry n waits n * retryDelay, matching Node’s linear backoff.
concurrencynumber1(Vooya FS) Max concurrent delete operations in recursive mode.

rmSync(path, options?)

Sync. Same Node arguments; calls Node directly and throws on error. The concurrency extension is validated but does not affect synchronous execution.

Performance

  • Recursive: Removal speed is workload-dependent. The current evidence does not establish a reliable advantage for every scale; increasing concurrency can hurt.
  • Single file: The public entry calls Node directly.

See Batch API evidence for the current measurements and their limits.

Local scale report

Generated from local performance reports. Do not edit this block by hand.

  • Runtime: v22.22.0 on darwin/arm64
  • Samples: 2 warmup runs, 10 measured runs
  • Aggregation: trimmed mean for wall-clock time; average per-run memory delta for RSS
ScaleFixtureNode.jsVooya FSRatioNode RSSVooya FS RSS
tiny8 files / 2 dirs0.42 ms0.41 ms1.04x faster0 B0 B
small104 files / 13 dirs2.47 ms2.63 ms1.06x slower0 B0 B
medium2728 files / 341 dirs75.23 ms68.29 ms1.10x faster12.8 KB0 B

Notes

  • Recursive: When recursive: true, Vooya FS uses rayon  for parallel deletion. Default concurrency is 1; values 0 and 1 are serial. Measure before increasing it.
  • Windows: maxRetries and retryDelay help with transient “access denied” or locking issues. Same semantics as Node.js.
  • Symlinks: Recursive removal does not follow symlinks; valid and broken links are removed without touching their targets.

An empty directory still requires recursive: true; force does not change that rule. Retry delays apply only to recursive removal and eligible error codes. The public entry uses Node for non-recursive calls, Windows removal and all rmSync calls, preserving runtime-specific synchronous errors.

Competitor measurements

See the full rm comparison table for Node 22/24, peer libraries, sync/Promise modes, small and batch workloads, execution routes and measurement limits.

Last updated on