Skip to content

Path.isDir() method

pathlib-ts > Path > isDir

Resolves to true when the path points to a directory.

Signature:

isDir(options?: {
followSymlinks?: boolean;
}): Promise<boolean>;

Parameter

Type

Description

options

{ followSymlinks?: boolean; }

(Optional) Optional follow-symlink toggle.

Returns:

Promise<boolean>

Promise resolving to true when the path is a directory.

Promise wrapper around Path.isDirSync(); match CPython semantics with followSymlinks.

Filtering directory entries asynchronously

import { Path } from "pathlib-ts";
const root = new Path("./src");
for (const entry of await root.iterdir()) {
if (await entry.isDir()) {
console.log(entry.name);
}
}