@adviser/cement - v0.0.0
    Preparing search index...

    Class Path

    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.

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    parts: PathItem[]

    Methods

    • Converts the path parts to a string representation.

      Returns string

      Path as a string with proper separators

      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.

      Parameters

      • part: PathItem

        Path component to add (string or PartType)

      Returns void

      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('..');