realPath
import { realPath } from "jsr:@ende/fs/unstable-real-path";function · experimental · requires --allow-read
async function realPath(path: string | URL): Promise<string>Resolves to the 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
A promise fulfilling with the absolute path of the file.
Example: Usage
import { realPath } from "@ende/fs/unstable-real-path";
import { symlink } from "@ende/fs/unstable-symlink";
// e.g. given /home/alice/file.txt and current directory /home/alice
await symlink("file.txt", "symlink_file.txt");
const fileRealPath = await realPath("./file.txt");
const realSymLinkPath = await realPath("./symlink_file.txt");
console.log(fileRealPath); // outputs "/home/alice/file.txt"
console.log(realSymLinkPath); // outputs "/home/alice/file.txt"