Skip to content

PurePath.root property

pathlib-ts > PurePath > root

A string representing the (local or global) root, if any.

Signature:

get root(): string;

Gets the root component (such as / or \\) following the drive, when present. For UNC paths the root reflects the separator after the host/share. POSIX roots collapse repeated slashes according to CPython rules.