readLinkSync

import { readLinkSync } from "jsr:@ende/fs/unstable-read-link";

function · experimental · requires --allow-read

function readLinkSync(path: string | URL): string

Synchronously returns the path destination of the named symbolic link.

Throws Error if called with a hard link.

Requires allow-read permission.

path: string | URL

The path of the symbolic link.

Returns

The file path pointed by the symbolic link.

Example: Usage

import { readLinkSync } from "@ende/fs/unstable-read-link";
import { symlinkSync } from "@ende/fs/unstable-symlink";
symlinkSync("./test.txt", "./test_link.txt");
const target = readLinkSync("./test_link.txt"); // full path of ./test.txt

Source