Path.stat() method
pathlib-ts > Path > stat
Path.stat() method
Section titled “Path.stat() method”Returns filesystem metadata asynchronously.
Signature:
stat(options?: { followSymlinks?: boolean; }): Promise<Stats>;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
options |
{ followSymlinks?: boolean; } |
(Optional) Optional follow-symlink toggle. |
Returns:
Promise<Stats>
A promise that resolves with fs.Stats information.
Remarks
Section titled “Remarks”Accepts followSymlinks to align with CPython behaviour.
Example
Section titled “Example”Asserting a directory exists before reading
import { Path } from "pathlib-ts";
const dataDir = new Path("./data");const stats = await dataDir.stat();console.log(stats.isDirectory());