Skip to Content
APIrmdir

rmdir

Remove an empty directory. Fails if the directory is not empty; use rm with recursive: true for non-empty trees.

Basic usage

import { rmdir } from '@vooya/fs' await rmdir('./empty-dir')

Methods

rmdir(path)

Async. Returns Promise<void>.

ArgumentTypeDescription
pathstringPath to the empty directory.

rmdirSync(path)

Sync. Same arguments; throws on error (e.g. ENOTEMPTY if not empty).

Performance

Single syscall; on par with Node.js. No dedicated benchmark; see Benchmarks for single-file overhead.

Notes

  • Non-empty: Use rm(path, { recursive: true }) to remove a directory and its contents.
  • Errors: Same as Node.js (e.g. ENOENT, ENOTEMPTY, EACCES).
  • Known gap: Filesystem errors currently have Node-like messages, but do not expose Node-style code, path, and syscall fields yet.
  • Unsupported Node inputs/options: Buffer paths, URL paths, and legacy rmdir options such as deprecated recursive removal are not part of the current Vooya FS rmdir surface.

Competitor measurements

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

Last updated on