Skip to Content
APIunlink

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>.

ArgumentTypeDescription
pathstringFile 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 }) or rmdir(path) for empty dirs. unlink on a directory fails with EISDIR (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, and syscall fields yet.
  • Directory code gap: Directory unlink failures are platform-specific in Node; Vooya FS currently reports EPERM text for directories.
  • Unsupported Node path inputs: Buffer paths and URL paths are not part of the current Vooya FS unlink surface.

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