Path.expandUserSync() method
pathlib-ts > Path > expandUserSync
Path.expandUserSync() method
Section titled “Path.expandUserSync() method”Expand leading ~ markers synchronously.
Signature:
expandUserSync(): Path;Returns:
A Path with user-home prefixes expanded.
Exceptions
Section titled “Exceptions”The Error class When the home directory cannot be determined.
Remarks
Section titled “Remarks”Mirrors Path.expandUser() but executes synchronously.
Example
Section titled “Example”Resolving a home-relative config synchronously
import { Path } from "pathlib-ts";
const config = new Path("~/.config/app/settings.json");console.log(config.expandUserSync().toString());