Path.cwd() method
pathlib-ts > Path > cwd
Path.cwd() method
Section titled “Path.cwd() method”Return a new path pointing to the current working directory.
Signature:
static cwd(): Promise<Path>;Returns:
Promise<Path>
Promise resolving to a Path instance targeting the current working directory.
Remarks
Section titled “Remarks”Mirrors the CPython API and caches the string representation for parity with the synchronous constructor.
Example
Section titled “Example”Discovering the working directory asynchronously
import { Path } from "pathlib-ts";
const cwd = await Path.cwd();console.log(cwd.toString());