Skip to Content
APIrealpath

realpath

Resolve the canonical absolute path for a path, resolving ., .., and symlinks.

Basic usage

import { realpath } from '@rush-fs/core' const abs = await realpath('./some/relative/path') console.log(abs) // e.g. /home/user/proj/some/relative/path

Methods

realpath(path)

Async. Returns Promise<string> (canonical absolute path).

ArgumentTypeDescription
pathstringPath to resolve.

realpathSync(path)

Sync. Returns string or throws.

Performance

Single syscall (with resolution); on par with Node.js. See Benchmarks.

Notes

  • Symlinks: Fully resolves symlinks in the path. Fails if the target does not exist (same as Node.js).
Last updated on