Skip to content

Path.statSync() method

pathlib-ts > Path > statSync

Retrieves filesystem metadata synchronously.

Signature:

statSync(options?: {
followSymlinks?: boolean;
}): Stats;

Parameter

Type

Description

options

{ followSymlinks?: boolean; }

(Optional) Optional follow-symlink toggle.

Returns:

Stats

Node.js fs.Stats describing the path.

Pass followSymlinks: false to mirror lstat. Mirrors Node’s fs.statSync/fs.lstatSync while preserving CPython semantics.

Inspecting file size synchronously

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