Skip to content

Path.cwdSync() method

pathlib-ts > Path > cwdSync

Create a Path pointing to the current working directory synchronously.

Signature:

static cwdSync(): Path;

Returns:

Path

A Path instance targeting the current working directory.

Mirrors Path.cwd() but executes synchronously.

Capturing the working directory synchronously

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