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>.
| Argument | Type | Description |
|---|---|---|
path | string | Path 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, andsyscallfields yet. - Unsupported Node inputs/options:
Bufferpaths,URLpaths, and legacyrmdiroptions such as deprecated recursive removal are not part of the current Vooya FSrmdirsurface.
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