Path builder for constructing and manipulating filesystem paths.
Represents a path as an array of parts (strings and special PartType tokens). Provides methods for adding path components and converting to string representation.
Readonly
Converts the path parts to a string representation.
Path as a string with proper separators
const path = new Path([PartType.Root, 'home', PartType.Slash, 'user']);path.toString(); // '/home/user' Copy
const path = new Path([PartType.Root, 'home', PartType.Slash, 'user']);path.toString(); // '/home/user'
Adds a path component to the path.
Handles special cases like duplicate slashes, "." and ".." segments.
Path component to add (string or PartType)
Error if adding absolute part to absolute path
const path = new Path();path.add(PartType.Root);path.add('home');path.add(PartType.Slash);path.add('..'); Copy
const path = new Path();path.add(PartType.Root);path.add('home');path.add(PartType.Slash);path.add('..');
Path builder for constructing and manipulating filesystem paths.
Represents a path as an array of parts (strings and special PartType tokens). Provides methods for adding path components and converting to string representation.