Skip to content

Path.resolve() method

pathlib-ts > Path > resolve

Make the path absolute, resolving symlinks and normalizing segments.

Signature:

resolve(): Promise<Path>;

Returns:

Promise<Path>

Promise resolving to a Path pointing to the resolved location.

Uses Node’s resolver to match CPython behavior, including symlink expansion.

Resolving user-provided input asynchronously

import { Path } from "pathlib-ts";
async function loadFile(input: string) {
const path = await new Path(input).resolve();
return path.readText();
}