Options
All
  • Public
  • Public/Protected
  • All
Menu

Lists files recursively starting from a given path.

Hierarchy

  • ListFiles

Index

Constructors

constructor

  • new ListFiles(startingPath: string, condition?: (path: string) => boolean): ListFiles
  • Creates an instance of list files.

    Parameters

    • startingPath: string

      the starting path to look for files.

    • Default value condition: (path: string) => boolean = file => true
        • (path: string): boolean
        • Parameters

          • path: string

          Returns boolean

    Returns ListFiles

Properties

Private condition

condition: (path: string) => boolean

Type declaration

    • (path: string): boolean
    • Parameters

      • path: string

      Returns boolean

Private files

files: Array<string> = []

Full absolute paths of all the files found.

Private startingPath

startingPath: string

the starting path to look for files.

Methods

Private handleFilePath

  • handleFilePath(file: string, dir: string): void
  • Checks wheather the path received is a file or a subdirectory. If it is a file, the full path is added to the list, else listFiles is invoked to go down the rabbit hole.

    Parameters

    • file: string

      the name of the file or folder found by listFiles.

    • dir: string

      the path to the file or folder found by listFiles.

    Returns void

init

  • init(): Array<string>

Private listFiles

  • listFiles(dir: string): void