realpath
Resolve the canonical absolute path for a path, resolving ., .., and symlinks.
Basic usage
import { realpath } from '@vooya/fs'
const abs = await realpath('./some/relative/path')
console.log(abs) // e.g. /home/user/proj/some/relative/pathMethods
realpath(path)
Async. Returns Promise<string> (canonical absolute path).
| Argument | Type | Description |
|---|---|---|
path | string | Path 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).
- Known gap: Missing-path errors currently have Node-like messages, but do not expose Node-style
code,path, andsyscallfields yet. - Unsupported Node inputs/options:
Bufferpaths,URLpaths, theencodingoption,realpath.native, and the legacy cache option are not part of the current Vooya FSrealpathsurface.
Competitor measurements
See the full realpath comparison table for Node 22/24, peer libraries, sync/Promise modes, small and batch workloads, execution routes and measurement limits.
Last updated on