realPathSync
import { realPathSync } from "jsr:@ende/fs/unstable-real-path";function · experimental · requires --allow-read
function realPathSync(path: string | URL): stringSynchronously returns absolute normalized path, with symbolic links resolved.
Requires allow-read permission for the target path.
Also requires allow-read permission for the CWD if the target path is
relative.
path: string | URLThe path of the file or directory.
Returns
The absolute path of the file.
Example: Usage
import { realPathSync } from "@ende/fs/unstable-real-path";
import { symlinkSync } from "@ende/fs/unstable-symlink";
// e.g. given /home/alice/file.txt and current directory /home/alice
symlinkSync("file.txt", "symlink_file.txt");
const realPath = realPathSync("./file.txt");
const realSymLinkPath = realPathSync("./symlink_file.txt");
console.log(realPath); // outputs "/home/alice/file.txt"
console.log(realSymLinkPath); // outputs "/home/alice/file.txt"