Skip to content

Path.lstat() method

pathlib-ts > Path > lstat

Asynchronously retrieves metadata about a symlink rather than its target. Like Path.stat(), except if the path points to a symlink, the symlink’s status information is returned, rather than its target’s.

Signature:

lstat(): Promise<Stats>;

Returns:

Promise<Stats>

A promise resolving to fs.Stats for the link itself.

Mirrors CPython’s Path.lstat() and Node’s fs.lstat behaviour.

Checking whether a dependency stub exists

import { Path } from "pathlib-ts";
const link = new Path("./node_modules/.bin/eslint");
const stat = await link.lstat();
console.log(stat.isSymbolicLink());