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 '@rush-fs/core' 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”.
Last updated on