readLink

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

function · experimental · requires --allow-read

async function readLink(path: string | URL): Promise<string>

Resolves to 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

A promise that resolves to the file path pointed by the symbolic link.

Example: Usage

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

Source