Path.isDir() method
pathlib-ts > Path > isDir
Path.isDir() method
Section titled “Path.isDir() method”Resolves to true when the path points to a directory.
Signature:
isDir(options?: { followSymlinks?: boolean; }): Promise<boolean>;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
options |
{ followSymlinks?: boolean; } |
(Optional) Optional follow-symlink toggle. |
Returns:
Promise<boolean>
Promise resolving to true when the path is a directory.
Remarks
Section titled “Remarks”Promise wrapper around Path.isDirSync(); match CPython semantics with followSymlinks.
Example
Section titled “Example”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); }}