Skip to Content
APIreadlink

readlink

Read the target path of a symbolic link. Fails for non-symlinks.

Basic usage

import { readlink } from '@rush-fs/core' const target = await readlink('./mylink') console.log(target) // resolved target path

Methods

readlink(path)

Async. Returns Promise<string> (the link target path).

ArgumentTypeDescription
pathstringSymlink path.

readlinkSync(path)

Sync. Returns string or throws (e.g. EINVAL if not a symlink).

Performance

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

Notes

  • Resolution: Returns the raw target string; use realpath to resolve to an absolute path and follow nested symlinks.
Last updated on