Skip to content

Path.absolute() method

pathlib-ts > Path > absolute

Return an absolute version of this path without resolving symlinks.

Signature:

absolute(): Promise<Path>;

Returns:

Promise<Path>

Promise resolving to an absolute Path.

Delegates to Path.resolve() when the path is relative, mirroring CPython’s absolute() behavior.

Ensuring an absolute destination asynchronously

import { Path } from "pathlib-ts";
const target = new Path("./dist/output.txt");
console.log((await target.absolute()).toString());