Skip to content

Path.isDirSync() method

pathlib-ts > Path > isDirSync

Tests whether the path is a directory synchronously.

Signature:

isDirSync(options?: {
followSymlinks?: boolean;
}): boolean;

Parameter

Type

Description

options

{ followSymlinks?: boolean; }

(Optional) Optional follow-symlink toggle.

Returns:

boolean

true when the path is a directory.

Returns false for missing paths and surfaces symlink handling via followSymlinks.

Distinguishing directories synchronously

import { Path } from "pathlib-ts";
const logs = new Path("./logs");
console.log(logs.isDirSync());