Skip to Content
APIsymlink

symlink

Create a symbolic link at path pointing to target. On Windows, type can be 'file', 'dir', or 'junction'; on Unix it is ignored.

Basic usage

import { symlink } from '@vooya/fs' await symlink('./target.txt', './link.txt') await symlink('./target-dir', './link-dir', 'dir') // Windows: directory symlink

Methods

symlink(target, path, type?)

Async. Returns Promise<void>.

ArgumentTypeDescription
targetstringTarget path (stored in the link).
pathstringSymlink path to create.
type’file’ | ‘dir’ | ‘junction’Optional. Windows only; ignored on Unix.

symlinkSync(target, path, type?)

Sync. Same arguments; throws on error (e.g. EEXIST if path exists).

Performance

Single syscall; on par with Node.js. See Benchmarks.

Notes

  • Windows: Use type: 'dir' for directory symlinks, 'file' for file symlinks, 'junction' for directory junctions when applicable.
  • Windows privileges: Creating symlinks can require developer mode or elevated privileges depending on the environment.
  • Relative target: Stored as-is; resolution is at read time (e.g. via readlink/realpath).
  • Known gap: Filesystem errors currently have Node-like messages, but do not expose Node-style code, path, dest, and syscall fields yet.
  • Current type gap: The TypeScript surface currently accepts any string for type; Node documents file, dir, and junction.
  • Unsupported Node path inputs: Buffer paths and URL paths are not part of the current Vooya FS symlink surface.

Competitor measurements

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

Last updated on