unlink
Remove a file. Fails for directories; use rm with recursive: true for directories.
Basic usage
import { unlink } from '@vooya/fs'
await unlink('./temp.txt')Methods
unlink(path)
Async. Returns Promise<void>.
| Argument | Type | Description |
|---|---|---|
path | string | File path to remove. |
unlinkSync(path)
Sync. Same arguments; throws on error (e.g. ENOENT, EISDIR).
Performance
Single syscall; on par with Node.js. No dedicated benchmark; see Benchmarks for single-file overhead.
Notes
- Directories: Use
rm(path, { recursive: true })orrmdir(path)for empty dirs.unlinkon a directory fails withEISDIR(or equivalent). - Symlinks: Removes the symlink entry itself, not the target file.
- Known gap: Filesystem errors currently have Node-like messages, but do not expose Node-style
code,path, andsyscallfields yet. - Directory code gap: Directory unlink failures are platform-specific in Node; Vooya FS currently reports
EPERMtext for directories. - Unsupported Node path inputs:
Bufferpaths andURLpaths are not part of the current Vooya FSunlinksurface.
Competitor measurements
See the full unlink comparison table for Node 22/24, peer libraries, sync/Promise modes, small and batch workloads, execution routes and measurement limits.
Last updated on