Skip to content

Path.readlink() method

pathlib-ts > Path > readlink

Return the path to which the symbolic link points.

Signature:

readlink(): Promise<Path>;

Returns:

Promise<Path>

Promise resolving to a Path representing the symlink target.

Resolves the link via Node’s fs.readlink and wraps it in a Path instance.

Resolving symlinks asynchronously

import { Path } from "pathlib-ts";
const shim = new Path("./node_modules/.bin/esbuild");
const target = await shim.readlink();
console.log(target.toString());