Skip to content

PurePath.name property

pathlib-ts > PurePath > name

Returns the final path component as a string, excluding any anchor, if any.

Signature:

get name(): string;

This mirrors CPython’s name property and respects flavour casing. For directory entries surfaced via Path.iterdir(), prefer this over fs.Dirent.name when you need canonical path semantics.