Skip to content

Path.home() method

pathlib-ts > Path > home

Return a new path pointing to the user’s home directory.

Signature:

static home(): Promise<Path>;

Returns:

Promise<Path>

Promise resolving to a Path instance targeting the user’s home directory.

The Error class When the home directory cannot be determined.

Leverages Node’s home directory detection to match CPython.

Fetching the home directory asynchronously

import { Path } from "pathlib-ts";
const home = await Path.home();
console.log(home.toString());