Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PathHelper

Various helper functions for directory and file paths.

Hierarchy

  • PathHelper

Index

Methods

getAbsolutePath

  • getAbsolutePath(path: string): string
  • Get the absolute path to a file or directory, resolved. If path is not absolute, it's considered to be relative to the current working directory. The resulting path will not have a trailing slash.

    Parameters

    • path: string

      The path to resolve.

    Returns string

ls

  • ls(dir: string, match?: RegExp, order?: number): Promise<string[]>
  • Get a list of files in a directory, matching a pattern and ordered by name.

    Parameters

    • dir: string

      The directory to list, which is resolved using getAbsolutePath.

    • Default value match: RegExp = /.*/

      A regex pattern that files must match.

    • Default value order: number = 1

      The order direction: 1 ascending: -1 descending.

    Returns Promise<string[]>

mkdirIfNotExists

  • mkdirIfNotExists(dir: string): Promise<void>
  • Create a directory if it doesn't exist.

    Parameters

    • dir: string

      To-be-created directory path.

    Returns Promise<void>

Generated using TypeDoc