Path.statSync() method
pathlib-ts > Path > statSync
Path.statSync() method
Section titled “Path.statSync() method”Retrieves filesystem metadata synchronously.
Signature:
statSync(options?: { followSymlinks?: boolean; }): Stats;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
options |
{ followSymlinks?: boolean; } |
(Optional) Optional follow-symlink toggle. |
Returns:
Stats
Node.js fs.Stats describing the path.
Remarks
Section titled “Remarks”Pass followSymlinks: false to mirror lstat. Mirrors Node’s fs.statSync/fs.lstatSync while preserving CPython semantics.
Example
Section titled “Example”Inspecting file size synchronously
import { Path } from "pathlib-ts";
const log = new Path("./logs/app.log");const stats = log.statSync();console.log(stats.size);