Path.home() method
pathlib-ts > Path > home
Path.home() method
Section titled “Path.home() method”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.
Exceptions
Section titled “Exceptions”The Error class When the home directory cannot be determined.
Remarks
Section titled “Remarks”Leverages Node’s home directory detection to match CPython.
Example
Section titled “Example”Fetching the home directory asynchronously
import { Path } from "pathlib-ts";
const home = await Path.home();console.log(home.toString());