Skip to Content
APIlink

link

Create a hard link from existingPath to newPath. Both paths refer to the same inode; not available on all filesystems (e.g. some Windows volumes).

Basic usage

import { link } from '@vooya/fs' await link('./existing.txt', './hardlink.txt')

Methods

link(existingPath, newPath)

Async. Returns Promise<void>.

ArgumentTypeDescription
existingPathstringExisting file path.
newPathstringNew hard link path.

linkSync(existingPath, newPath)

Sync. Same arguments; throws on error (e.g. EXDEV on cross-filesystem, or unsupported).

Performance

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

Notes

  • Filesystems: Hard links may not be supported (e.g. FAT, some network drives); same as Node.js.
  • Directories: Typically not allowed for directories; use symlinks for directory “aliases”.
  • Known gap: Missing-source and existing-destination errors currently have Node-like messages, but do not expose Node-style code, path, dest, and syscall fields yet.
  • Unsupported Node path inputs: Buffer paths and URL paths are not part of the current Vooya FS link surface.

Competitor measurements

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

Last updated on