Path.exists() method
pathlib-ts > Path > exists
Path.exists() method
Section titled “Path.exists() method”Resolves to true when the path exists.
Signature:
exists(options?: { followSymlinks?: boolean; }): Promise<boolean>;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
options |
{ followSymlinks?: boolean; } |
(Optional) Optional follow-symlink toggle. |
Returns:
Promise<boolean>
A promise resolving to a boolean indicating existence.
Remarks
Section titled “Remarks”Follows symlinks by default; pass followSymlinks: false to check whether symlink exists.
Example
Section titled “Example”Skipping optional config during startup
import { Path } from "pathlib-ts";
const localConfig = new Path("./config.local.json");if (await localConfig.exists()) { console.log("loading overrides");}