PurePath.parts property
pathlib-ts > PurePath > parts
PurePath.parts property
Section titled “PurePath.parts property”Returns the normalized path components as an array of strings.
Signature:
get parts(): string[];Remarks
Section titled “Remarks”The first element is the anchor when present. Use this when you need positional access to segments without re-parsing the representation.
Example
Section titled “Example”const p = new PurePath('/usr/bin/python3')p.parts // ['/', 'usr', 'bin', 'python3']
const p = new PureWindowsPath('c:/Program Files/PSF')p.parts // ['c:\\', 'Program Files', 'PSF']