Skip to content

Path.homeSync() method

pathlib-ts > Path > homeSync

Return the user’s home directory synchronously.

Signature:

static homeSync(): Path;

Returns:

Path

A Path instance targeting the user’s home directory.

The Error class When the home directory cannot be determined.

Mirrors Path.home() but executes synchronously.

Resolving the home directory synchronously

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