Skip to content

PathInfoBase class

pathlib-ts > PathInfoBase

Cached stat provider

Signature:

export declare class PathInfoBase

Instances wrap a filesystem path string and lazily cache fs.statSync / fs.lstatSync results. Methods such as PathInfoBase.exists() resolve once and reuse their cached value to avoid duplicate system calls when Path.info is reused across operations.

Reusing cached metadata during a build step

import { Path } from "pathlib-ts";
const entry = new Path("./dist/app.js");
const info = entry.info; // PathInfoBase instance
if (await info.exists()) {
console.log(await info.isFile());
}

Constructor

Modifiers

Description

(constructor)(p)

Constructs a new instance of the PathInfoBase class

Property

Modifiers

Type

Description

pathStr

protected

string

Method

Modifiers

Description

accessTimeNs(followSymlinks)

exists(followSymlinks)

fileId(followSymlinks)

isDir(followSymlinks)

isFile(followSymlinks)

isSymlink()

modTimeNs(followSymlinks)

statInternal(opts)

protected

statInternalSync(opts)

protected

Synchronous variant of statInternal. Mirrors the async behavior but uses fs.statSync/fs.lstatSync.

toString()