Options
All
  • Public
  • Public/Protected
  • All
Menu

find-files-by-patterns

Index

Type aliases

Filter<T>: (element: T) => Promise<boolean>

Type parameters

  • T

Type declaration

    • (element: T): Promise<boolean>
    • A filter is a test function which determines whether or not a given element should be kept.

      Parameters

      • element: T

        The element to filter in or out.

      Returns Promise<boolean>

FilterSync<T>: (element: T) => boolean

Type parameters

  • T

Type declaration

    • (element: T): boolean
    • A filter is a test function which determines whether or not a given element should be kept.

      Parameters

      • element: T

        The element to filter in or out.

      Returns boolean

Functions

  • allElements<T>(iterable: Iterable<T> | AsyncIterable<T>): Promise<T[]>
  • Retrieves all the elements of an iterable. The iterable should be finite.

    Type parameters

    • T

      The type of iterated elements.

    Parameters

    • iterable: Iterable<T> | AsyncIterable<T>

      The iterable from which to retrieve all the elements.

    Returns Promise<T[]>

    The array of all the elements of the given iterable in sequential order.

  • allElementsSync<T>(iterable: Iterable<T>): T[]
  • Retrieves all the elements of an iterable. The iterable should be finite.

    Type parameters

    • T

      The type of iterated elements.

    Parameters

    • iterable: Iterable<T>

      The iterable from which to retrieve all the elements.

    Returns T[]

    The array of all the elements of the given iterable in sequential order.

  • A conjunction is a filter which combines a given array of filters using logical conjunction. This means that any element that passes the combined test has passed all of the filters.

    Type parameters

    • T

      The type of elements to filter.

    Parameters

    Returns Filter<T>

    The logical conjunction of the given tests.

  • A conjunction is a filter which combines a given array of filters using logical conjunction. This means that any element that passes the combined test has passed all of the filters.

    Type parameters

    • T

      The type of elements to filter.

    Parameters

    • filters: FilterSync<T>[]

      The filters to combine in conjunction.

    Returns FilterSync<T>

    The logical conjunction of the given tests.

  • A disjunction is a filter which combines a given array of filters using logical disjunction. This means that any element that passes the combined test has passed at least one of the filters.

    Type parameters

    • T

      The type of elements to filter.

    Parameters

    Returns Filter<T>

    The logical disjunction of the given tests.

  • A disjunction is a filter which combines a given array of filters using logical disjunction. This means that any element that passes the combined test has passed at least one of the filters.

    Type parameters

    • T

      The type of elements to filter.

    Parameters

    • filters: FilterSync<T>[]

      The filters to combine in disjunction.

    Returns FilterSync<T>

    The logical disjunction of the given tests.

  • downwardDirectories(): AsyncIterable<string>
  • downwardDirectories(maximumDepth: number): AsyncIterable<string>
  • downwardDirectories(startDirectory: string): AsyncIterable<string>
  • downwardDirectories(startDirectory: string, maximumDepth: number): AsyncIterable<string>
  • Constructs an iterable over the downward directories starting from the current working directory. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once. The current working directory is not yielded.

    Returns AsyncIterable<string>

    An iterable over the downward directories.

  • Constructs an iterable over the downward directories starting from the current working directory and down to a given maximum depth of a directory. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once. The start directory is not yielded.

    throws

    If the maximum depth is negative.

    Parameters

    • maximumDepth: number

      The maximum depth of a read directory relative to the start directory. This maximum depth should be zero or positive.

    Returns AsyncIterable<string>

    An iterable over the downward directories down to the maximum depth.

  • Constructs an iterable over the downward directories starting from a given path. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once. The start directory is not yielded.

    throws

    If the start path is a file.

    throws

    If the start path is inexistant.

    Parameters

    • startDirectory: string

      The start directory from which to start the downward traversal.

    Returns AsyncIterable<string>

    An iterable over the downward directories.

  • Constructs an iterable over the downward directories starting from a given path and down to a given maximum depth of a directory. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once. The start directory is not yielded.

    throws

    If the start path is a file.

    throws

    If the start path is inexistant.

    throws

    If the maximum depth is negative.

    Parameters

    • startDirectory: string

      The start directory from which to start the downward traversal.

    • maximumDepth: number

      The maximum depth of a read directory relative to the start directory. This maximum depth should be zero or positive.

    Returns AsyncIterable<string>

    An iterable over the downward directories down to the maximum depth.

  • downwardDirectoriesSync(): Iterable<string>
  • downwardDirectoriesSync(maximumDepth: number): Iterable<string>
  • downwardDirectoriesSync(startDirectory: string): Iterable<string>
  • downwardDirectoriesSync(startDirectory: string, maximumDepth: number): Iterable<string>
  • Constructs an iterable over the downward directories starting from the current working directory. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once. The start directory is not yielded.

    Returns Iterable<string>

    An iterable over the downward directories.

  • Constructs an iterable over the downward directories starting from the current working directory and down to a given maximum depth of a directory. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once. The start directory is not yielded.

    throws

    If the maximum depth is negative.

    Parameters

    • maximumDepth: number

      The maximum depth of a read directory relative to the start directory. This maximum depth should be zero or positive.

    Returns Iterable<string>

    An iterable over the downward directories down to the maximum depth.

  • Constructs an iterable over the downward directories starting from a given path. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once. The start directory is not yielded.

    throws

    If the start path is a file.

    throws

    If the start path is inexistant.

    Parameters

    • startDirectory: string

      The start directory from which to start the downward traversal.

    Returns Iterable<string>

    An iterable over the downward directories.

  • Constructs an iterable over the downward directories starting from a given path and down to a given maximum depth of a directory. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once. The start directory is not yielded.

    throws

    If the start path is a file.

    throws

    If the start path is inexistant.

    throws

    If the maximum depth is negative.

    Parameters

    • startDirectory: string

      The start directory from which to start the downward traversal.

    • maximumDepth: number

      The maximum depth of a read directory relative to the start directory. This maximum depth should be zero or positive.

    Returns Iterable<string>

    An iterable over the downward directories down to the maximum depth.

  • downwardFiles(): AsyncIterable<string>
  • downwardFiles(maximumDepth: number): AsyncIterable<string>
  • downwardFiles(startDirectory: string): AsyncIterable<string>
  • downwardFiles(startDirectory: string, maximumDepth: number): AsyncIterable<string>
  • Constructs an iterable over the downward files starting from the current working directory. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once.

    Returns AsyncIterable<string>

    An iterable over the downward files.

  • Constructs an iterable over the downward files starting from the current working directory and down to a given maximum depth of a directory. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once.

    throws

    If the maximum depth is negative.

    Parameters

    • maximumDepth: number

      The maximum depth of a read directory relative to the start directory. This maximum depth should be zero or positive.

    Returns AsyncIterable<string>

    An iterable over the downward files down to the maximum depth.

  • Constructs an iterable over the downward files starting from a given path. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once.

    throws

    If the starting path is a file.

    throws

    If the starting path is inexistant.

    Parameters

    • startDirectory: string

      The starting directory from which to start the downward traversal.

    Returns AsyncIterable<string>

    An iterable over the downward files.

  • Constructs an iterable over the downward files starting from a given path and down to a given maximum depth of a directory. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once.

    throws

    If the starting path is a file.

    throws

    If the starting path is inexistant.

    throws

    If the maximum depth is negative.

    Parameters

    • startDirectory: string

      The starting directory from which to start the downward traversal.

    • maximumDepth: number

      The maximum depth of a read directory relative to the start directory. This maximum depth should be zero or positive.

    Returns AsyncIterable<string>

    An iterable over the downward files down to the maximum depth.

  • downwardFilesSync(): Iterable<string>
  • downwardFilesSync(maximumDepth: number): Iterable<string>
  • downwardFilesSync(startDirectory: string): Iterable<string>
  • downwardFilesSync(startDirectory: string, maximumDepth: number): Iterable<string>
  • Constructs an iterable over the downward files starting from the current working directory. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once.

    Returns Iterable<string>

    An iterable over the downward files.

  • Constructs an iterable over the downward files starting from the current working directory and down to a given maximum depth of a directory. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once.

    throws

    If the maximum depth is negative.

    Parameters

    • maximumDepth: number

      The maximum depth of a read directory relative to the start directory. This maximum depth should be zero or positive.

    Returns Iterable<string>

    An iterable over the downward files down to the maximum depth.

  • Constructs an iterable over the downward files starting from a given path. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once.

    throws

    If the starting path is a file.

    throws

    If the starting path is inexistant.

    Parameters

    • startDirectory: string

      The starting directory from which to start the downward traversal.

    Returns Iterable<string>

    An iterable over the downward files.

  • Constructs an iterable over the downward files starting from a given path and down to a given maximum depth of a directory. Symbolic links are followed, and the directories are traversed in breadth-first order. Directories are read only once.

    throws

    If the starting path is a file.

    throws

    If the starting path is inexistant.

    throws

    If the maximum depth is negative.

    Parameters

    • startDirectory: string

      The starting directory from which to start the downward traversal.

    • maximumDepth: number

      The maximum depth of a read directory relative to the start directory. This maximum depth should be zero or positive.

    Returns Iterable<string>

    An iterable over the downward files down to the maximum depth.

  • filter<T>(iterable: Iterable<T> | AsyncIterable<T>, filter: Filter<T> | FilterSync<T>): AsyncIterable<T>
  • Filters out elements of an iterable which don't pass a given filter.

    throws

    If the filter throws an error for any of the elements of the iterable.

    Type parameters

    • T

      The type of elements to filter.

    Parameters

    • iterable: Iterable<T> | AsyncIterable<T>

      The iterable to filter.

    • filter: Filter<T> | FilterSync<T>

      The filter an element must pass in order to be filtered in.

    Returns AsyncIterable<T>

    An iterable over the filtered elements.

  • filterSync<T>(iterable: Iterable<T>, filter: FilterSync<T>): Iterable<T>
  • Filters out elements of an iterable which don't pass a given filter.

    throws

    If the filter throws an error for any of the elements of the iterable.

    Type parameters

    • T

      The type of elements to filter.

    Parameters

    • iterable: Iterable<T>

      The iterable to filter.

    • filter: FilterSync<T>

      The filter an element must pass in order to be filtered in.

    Returns Iterable<T>

    An iterable over the filtered elements.

  • findAllFiles(...tests: (FilterSync<string> | Filter<string>)[]): Promise<string[]>
  • findAllFiles(directories: string | Iterable<string> | AsyncIterable<string>, ...tests: (FilterSync<string> | Filter<string>)[]): Promise<string[]>
  • Reads the current working directory and performs the given tests on all of its soft and hard-linked files in order to find the files or directories whose path passes all of the tests.

    rejects

    If one of the given tests throws an error.

    example

    Consider the following file structure:

    /home/user/project
    ├── data.csv
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file of base name data.json, then no file will be found matching that test and the function will resolve to null.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file whose root name is data, then the function will resolve to /home/user/project/data/data.json and /home/user/project/data/data.yaml.

    Parameters

    • Rest ...tests: (FilterSync<string> | Filter<string>)[]

      The sequence of tests a file or directory's path must pass in order to be considered among the desired paths to be found. If a path does not match any of the tests, then it is ignored. If no tests are specified, then the promise will arbitrarily be resolved to null.

    Returns Promise<string[]>

    The files or directories' path in the current working directory that pass all the tests. These paths are sorted alphanumerically.

  • Reads the given directories and performs the given tests on all of their soft and hard-linked files in order to find the files or directories' path that passes all of the tests.

    rejects

    If any of the given directories' path cannot be resolved to a directory.

    rejects

    If one of the given tests throws an error.

    example

    Consider the following given directories:

    • /home/user/project/files
    • ./files
    • files

    If the current working directory is /home/user/project, then all the previous directories refer to the same location and each of them will be resolved to /home/user/project/files before any file is tested.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file whose root name is data, then the promise will resolve with both /home/user/project/data/data.json and /home/user/project/data/data.yaml.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   ├── data.json
    |   └── data.yaml
    └── files
        └── data.json
    

    Let /home/user/project be the current working directory. If the test performed on each file in the directories ./data and ./files is for a file whose root name is data, then the promise will resolve with /home/user/project/data/data.json, /home/user/project/data/data.yaml and /home/user/project/files/data.json. The returned files from the ./data directory are sorted alphanumerically. The matching files from ./data are returned before those of ./files since ./data was given first as a directory to explore.

    Parameters

    • directories: string | Iterable<string> | AsyncIterable<string>

      The directories' path in which to search for files or directories' path that pass all the tests. If any of these directories is not absolute, then it is resolved relative to the current working directory.

    • Rest ...tests: (FilterSync<string> | Filter<string>)[]

      The sequence of tests a file or directory's path must pass in order to be considered among the paths found. If a path does not match any of the tests, then it is ignored.

    Returns Promise<string[]>

    A promise for the files or directories' path in the directories that pass all the tests. The paths are returned in order of directory and sorted alphanumerically by base name in each directory.

  • findAllFilesSync(...tests: FilterSync<string>[]): string[]
  • findAllFilesSync(directories: string | Iterable<string>, ...tests: FilterSync<string>[]): string[]
  • Reads the current working directory and performs the given tests on all of its soft and hard-linked files in order to find the files or directories whose path passes all of the tests.

    throws

    If one of the given tests throws an error.

    example

    Consider the following file structure:

    /home/user/project
    ├── data.csv
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file of base name data.json, then no file will be found matching that test and the function will return null.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file whose root name is data, then the function will return /home/user/project/data/data.json and /home/user/project/data/data.yaml.

    Parameters

    • Rest ...tests: FilterSync<string>[]

      The sequence of tests a file or directory's path must pass in order to be considered among the desired paths to be found. If a path does not match any of the tests, then it is ignored. If no tests are specified, then the function will arbitrarily return null.

    Returns string[]

    The files or directories' path in the current working directory that pass all the tests. These paths are sorted alphanumerically.

  • Reads the given directories and performs the given tests on all of their soft and hard-linked files in order to find the files or directories whose path passes all of the tests.

    throws

    If any of the given directories' path cannot be resolved to a directory.

    throws

    If one of the given tests throws an error.

    example

    Consider the following given directories:

    • /home/user/project/files
    • ./files
    • files

    If the current working directory is /home/user/project, then all the previous directories refer to the same location and each of them will be resolved to /home/user/project/files before any file is tested.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file whose root name is data, then the function will return both /home/user/project/data/data.json and /home/user/project/data/data.yaml.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   ├── data.json
    |   └── data.yaml
    └── files
        └── data.json
    

    Let /home/user/project be the current working directory. If the test performed on each file in the directories ./data and ./files is for a file whose root name is data, then the function will return /home/user/project/data/data.json, /home/user/project/data/data.yaml and /home/user/project/files/data.json. The returned files from the ./data directory are sorted alphanumerically. The matching files from ./data are returned before those of ./files since ./data was given first as a directory to explore.

    Parameters

    • directories: string | Iterable<string>

      The directories' path in which to search for all the files or directories' path that pass all the tests. If any of these directories is not absolute, then it is resolved relative to the current working directory.

    • Rest ...tests: FilterSync<string>[]

      The sequence of tests a file or directory's path must pass in order to be considered among the desired paths to be found. If a path does not match any of the tests, then it is ignored. If no tests are specified, then the function will arbitrarily return null.

    Returns string[]

    The files or directories' path in the given directories that pass all the tests. The paths are returned in order of directory and sorted alphanumerically by base name in each directory.

  • findFile(...tests: (FilterSync<string> | Filter<string>)[]): Promise<string | null>
  • findFile(directories: string | Iterable<string> | AsyncIterable<string>, ...tests: (FilterSync<string> | Filter<string>)[]): Promise<string | null>
  • Reads the current working directory and performs the given tests on all of its soft and hard-linked files in order to find the first file or directory's path in it that passes all of the tests.

    rejects

    If one of the given tests throws an error.

    example

    Consider the following file structure:

    /home/user/project
    ├── data.csv
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file of base name data.json, then no file will be found matching that test and the promise will resolve to null.

    example

    Consider the following file structure:

    /home/user/project
    ├── data.json
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file of base name data.json, then the promise will resolve to /home/user/project/data.json.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file whose name is data, then the promise may resolve to either /home/user/project/data/data.json or /home/user/project/data/data.yaml since both pass the test and are in the same directory.

    Parameters

    • Rest ...tests: (FilterSync<string> | Filter<string>)[]

      The sequence of tests a file or directory's path must pass in order to be considered the desired path to be found. If a path does not match any of the tests, then it is ignored. If no tests are specified, then the promise will arbitrarily resolve to null. These tests should be declared such that there can only exist one path that passes them all, otherwise the function may not be deterministic. A test for a path whose base name is equal to a string has that uniqueness.

    Returns Promise<string | null>

    A promise for either the path to the file or directory that is the first one found in the current working directory such that it passes all the tests, or null if there is no such path in the current working directory.

  • Reads the given directories and performs the given tests on all of their soft and hard-linked files in order to find the first file or directory's path in its directory that passes all of the tests.

    rejects

    If any of the given directories' path cannot be resolved to a directory.

    rejects

    If one of the given tests throws an error.

    example

    Consider the following given directories:

    • /home/user/project/files
    • ./files
    • files

    If the current working directory is /home/user/project, then all the previous directories refer to the same location and each of them will be resolved to /home/user/project/files before any file is tested.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.csv
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file of base name data.json, then no file will be found matching that test and the promise will resolve to null.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   ├── data.csv
    |   └── data.yaml
    └── files
        └── index.html
    

    If the test performed on each file of the directories /home/user/project/data and /home/user/project/files is for a file of base name data.json, then no file will be found matching that test and the promise will resolve to null.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file of base name data.json, then the promise will resolve to /home/user/project/data/data.json.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   ├── data.json
    |   └── data.yaml
    └── files
        └── index.html
    

    If the test performed on each file of the directories /home/user/project/data and /home/user/project/files is for a file of base name data.json, then the promise will resolve to /home/user/project/data/data.json.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file whose name is data, then the promise may return either /home/user/project/data/data.json or /home/user/project/data/data.yaml since both pass the test and are in the same directory.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   └── data.json
    └── files
        └── data.json
    

    If the test performed on each file of the directories /home/user/project/data and /home/user/project/files is for a file of base name data.json, then the promise will resolve to /home/user/project/data/data.json since it is the first of the two directories to be explored and there is only one file of base name data.json in it.

    Parameters

    • directories: string | Iterable<string> | AsyncIterable<string>

      The directories' path in which to search for a single file or directory's path that passes all the tests. If any of these directories is not absolute, then it is resolved relative to the current working directory.

    • Rest ...tests: (FilterSync<string> | Filter<string>)[]

      The sequence of tests a file's path must pass in order to be considered the desired file to be found. If a file's path does not match any of the tests, then it is ignored. If no tests are specified, then the promise will arbitrarily resolve to null. These tests should be declared such that there can only exist one path that passes them all, otherwise the function may not be deterministic. A test for a path whose base name is equal to a string has that uniqueness.

    Returns Promise<string | null>

    A promise for either the path to the file or directory that is the first one found in the directories such that it passes all the tests, or null if there is no such path in any of the directories.

  • findFileSync(...tests: FilterSync<string>[]): string | null
  • findFileSync(directories: string | Iterable<string>, ...tests: FilterSync<string>[]): string | null
  • Reads the current working directory and performs the given tests on all of its soft and hard-linked files in order to find the first file or directory's path in it that passes all of the tests.

    throws

    If one of the given tests throws an error.

    example

    Consider the following file structure:

    /home/user/project
    ├── data.csv
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file of base name data.json, then no file will be found matching that test and the function will return null.

    example

    Consider the following file structure:

    /home/user/project
    ├── data.json
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file of base name data.json, then the function will return /home/user/project/data.json.

    Parameters

    • Rest ...tests: FilterSync<string>[]

      The sequence of tests a file or directory's path must pass in order to be considered the desired file to be found. If a path does not match any of the tests, then it is ignored. If no tests are specified, then the function will arbitrarily return null. These tests should be declared such that there can only exist one path that passes them all, otherwise the function may not be deterministic. A test for a path whose base name is equal to a string has that uniqueness.

    Returns string | null

    Either the path to the file or directory that is the first one found in the current working directory such that it passes all the tests, or null if there is no such path in the current working directory.

  • Reads the given directories and performs the given tests on all of their soft and hard-linked files in order to find the first file or directory's path in its directory that passes all of the tests.

    throws

    If any of the given directories' path cannot be resolved to a directory.

    throws

    If one of the given tests throws an error.

    example

    Consider the following given directories:

    • /home/user/project/files
    • ./files
    • files

    If the current working directory is /home/user/project, then all the previous directories refer to the same location and each of them will be resolved to /home/user/project/files before any file is tested.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.csv
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file of base name data.json, then no file will be found matching that test and the function will return null.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   ├── data.csv
    |   └── data.yaml
    └── files
        └── index.html
    

    If the test performed on each file of the directories /home/user/project/data and /home/user/project/files is for a file of base name data.json, then no file will be found matching that test and the function will return null.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file of base name data.json, then the function will return /home/user/project/data/data.json.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   ├── data.json
    |   └── data.yaml
    └── files
        └── index.html
    

    If the test performed on each file of the directories /home/user/project/data and /home/user/project/files is for a file of base name data.json, then the function will return /home/user/project/data/data.json.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file whose root name is data, then the function may return either /home/user/project/data/data.json or /home/user/project/data/data.yaml since they both pass the test.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   └── data.json
    └── files
        └── data.json
    

    If the test performed on each file of the directories /home/user/project/data and /home/user/project/files is for a file of base name data.json, then the function will return /home/user/project/data/data.json since it is the first of the two directories to be explored and there is only one file of base name data.json in it.

    Parameters

    • directories: string | Iterable<string>

      The directories' path in which to search for the first file or directory's path that passes all the tests. If any of these directories is not absolute, then it is resolved relative to the current working directory.

    • Rest ...tests: FilterSync<string>[]

      The sequence of tests a file or directory's path must pass in order to be considered the desired path to be found. If a file's path does not match any of the tests, then it is ignored. If no tests are specified, then the function will arbitrarily return null. These tests should be declared such that there can only exist one path that passes them all, otherwise the function may not be deterministic. A test for a path whose base name is equal to a string has that uniqueness.

    Returns string | null

    Either the path to the file or directory that is the first one found in the directories such that it passes all the tests, or null if there is no such path in any of the directories.

  • findOnlyFile(...tests: (FilterSync<string> | Filter<string>)[]): Promise<string | null>
  • findOnlyFile(directories: string | Iterable<string> | AsyncIterable<string>, ...tests: (FilterSync<string> | Filter<string>)[]): Promise<string | null>
  • Reads the current working directory and performs the given tests on all of its soft and hard-linked files in order to find the first and only file or directory's path in it that passes all of the tests.

    rejects

    If there exists more than one path that passes all the given tests in the same directory.

    rejects

    If one of the given tests throws an error.

    example

    Consider the following file structure:

    /home/user/project
    ├── data.csv
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file of base name data.json, then no file will be found matching that test and the promise will resolve to null.

    example

    Consider the following file structure:

    /home/user/project
    ├── data.json
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file of base name data.json, then the promise will resolve to /home/user/project/data.json.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file whose name is data, then the promise will be rejected, since both /home/user/project/data/data.json and /home/user/project/data/data.yaml pass the test and are in the same directory.

    Parameters

    • Rest ...tests: (FilterSync<string> | Filter<string>)[]

      The sequence of tests a file or directory's path must pass in order to be considered the desired file to be found. If a path does not match any of the tests, then it is ignored. If two or more paths satisfy all of the tests, then the promise is rejected, since only a single path is desired. If no tests are specified, then the promise will arbitrarily resolve to null.

    Returns Promise<string | null>

    A promise for either the path to the file or directory that is the first and the only one found in the current working directory such that it passes all the tests, or null if there is no such path in the current working directory.

  • Reads the given directories and performs the given tests on all of their soft and hard-linked files in order to find the first and only file or directory's path in its directory that passes all of the tests.

    rejects

    If any of the given directories' path cannot be resolved to a directory.

    rejects

    If there exists more than one path that passes all the given tests in the same directory.

    rejects

    If one of the given tests throws an error.

    example

    Consider the following given directories:

    • /home/user/project/files
    • ./files
    • files

    If the current working directory is /home/user/project, then all the previous directories refer to the same location and each of them will be resolved to /home/user/project/files before any file is tested.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.csv
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file of base name data.json, then no file will be found matching that test and the promise will resolve to null.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   ├── data.csv
    |   └── data.yaml
    └── files
        └── index.html
    

    If the test performed on each file of the directories /home/user/project/data and /home/user/project/files is for a file of base name data.json, then no file will be found matching that test and the promise will resolve to null.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file of base name data.json, then the promise will resolve to /home/user/project/data/data.json.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   ├── data.json
    |   └── data.yaml
    └── files
        └── index.html
    

    If the test performed on each file of the directories /home/user/project/data and /home/user/project/files is for a file of base name data.json, then the promise will resolve to /home/user/project/data/data.json.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file whose name is data, then the promise will be rejected, since both /home/user/project/data/data.json and /home/user/project/data/data.yaml pass the test and are in the same directory.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   └── data.json
    └── files
        └── data.json
    

    If the test performed on each file of the directories /home/user/project/data and /home/user/project/files is for a file of base name data.json, then the promise will resolve to /home/user/project/data/data.json since it is the first of the two directories to be explored and there is only one file of base name data.json in it.

    Parameters

    • directories: string | Iterable<string> | AsyncIterable<string>

      The directories' path in which to search for a single file or directory's path that passes all the tests. If any of these directories is not absolute, then it is resolved relative to the current working directory.

    • Rest ...tests: (FilterSync<string> | Filter<string>)[]

      The sequence of tests a file or directory's path must pass in order to be considered the desired path to be found. If a path does not match any of the tests, then it is ignored. If two or more paths satisfy all of the tests, then the promise is rejected, since only a single path is desired. If no tests are specified, then the promise will arbitrarily resolve to null.

    Returns Promise<string | null>

    A promise for either the path to the file or directory that is the first and the only one found in the directories such that it passes all the tests, or null if there is no such file in any of the directories.

  • findOnlyFileSync(...tests: FilterSync<string>[]): string | null
  • findOnlyFileSync(directories: string | Iterable<string>, ...tests: FilterSync<string>[]): string | null
  • Reads the current working directory and performs the given tests on all of its soft and hard-linked files in order to find the first and only file or directory's path in it that passes all of the tests.

    throws

    If there exists more than one path that passes all the given tests in the current working directory.

    throws

    If one of the given tests throws an error.

    example

    Consider the following file structure:

    /home/user/project
    ├── data.csv
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file of base name data.json, then no file will be found matching that test and the function will return null.

    example

    Consider the following file structure:

    /home/user/project
    ├── data.json
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file of base name data.json, then the function will return /home/user/project/data.json.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the current working directory is /home/user/project and the test performed on each file of the directory is for a file whose root name is data, then the function will throw an error, since both /home/user/project/data/data.json and /home/user/project/data/data.yaml pass the test and are in the same directory.

    Parameters

    • Rest ...tests: FilterSync<string>[]

      The sequence of tests a file or directory's path must pass in order to be considered the desired path to be found. If a path does not match any of the tests, then it is ignored. If two or more paths satisfy all of the tests, then an error is thrown, since only a single path is desired. If no tests are specified, then the function will arbitrarily return null.

    Returns string | null

    Either the path to the file or directory that is the first and the only one found in the current working directory such that it passes all the tests, or null if there is no such path in the current working directory.

  • Reads the given directories and performs the given tests on all of their soft and hard-linked files in order to find the first and only file or directory's path in its directory that passes all of the tests.

    throws

    If any of the given directories' path cannot be resolved to a directory.

    throws

    If there exists more than one path that passes all the given tests in the same directory.

    throws

    If one of the given tests throws an error.

    example

    Consider the following given directories:

    • /home/user/project/files
    • ./files
    • files

    If the current working directory is /home/user/project, then all the previous directories refer to the same location and each of them will be resolved to /home/user/project/files before any file is tested.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.csv
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file of base name data.json, then no file will be found matching that test and the function will return null.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   ├── data.csv
    |   └── data.yaml
    └── files
        └── index.html
    

    If the test performed on each file of the directories /home/user/project/data and /home/user/project/files is for a file of base name data.json, then no file will be found matching that test and the function will return null.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file of base name data.json, then the function will return /home/user/project/data/data.json.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   ├── data.json
    |   └── data.yaml
    └── files
        └── index.html
    

    If the test performed on each file of the directories /home/user/project/data and /home/user/project/files is for a file of base name data.json, then the function will return /home/user/project/data/data.json.

    example

    Consider the following file structure:

    /home/user/project/data
    ├── data.json
    └── data.yaml
    

    If the test performed on each file of the directory /home/user/project/data is for a file whose root name is data, then the function will throw an error, since both /home/user/project/data/data.json and /home/user/project/data/data.yaml pass the test and are in the same directory.

    example

    Consider the following file structure:

    /home/user/project
    ├── data
    |   └── data.json
    └── files
        └── data.json
    

    If the test performed on each file of the directories /home/user/project/data and /home/user/project/files is for a file of base name data.json, then the function will return /home/user/project/data/data.json since it is the first of the two directories to be explored and there is only one file of base name data.json in it.

    Parameters

    • directories: string | Iterable<string>

      The directories' path in which to search for a single file's path that passes all the tests. If any of these directories is not absolute, then it is resolved relative to the current working directory.

    • Rest ...tests: FilterSync<string>[]

      The sequence of tests a file or directory's path must pass in order to be considered the desired path to be found. If a path does not match any of the tests, then it is ignored. If two or more paths satisfy all of the tests, then an error is thrown, since only a single path is desired. If no tests are specified, then the function will arbitrarily return null.

    Returns string | null

    Either the path to the file or directory that is the first and the only one found in the directories such that it passes all the tests, or null if there is no such path in any of the directories.

  • firstElement<T>(iterable: Iterable<T> | AsyncIterable<T>): Promise<T>
  • Retrieves the first element of an iterable.

    Type parameters

    • T

      The type of iterated elements.

    Parameters

    • iterable: Iterable<T> | AsyncIterable<T>

      The iterable from which to retrieve the first element.

    Returns Promise<T>

    The first element of the given iterable.

  • firstElementSync<T>(iterable: Iterable<T>): T
  • Retrieves the first element of an iterable.

    Type parameters

    • T

      The type of iterated elements.

    Parameters

    • iterable: Iterable<T>

      The iterable from which to retrieve the first element.

    Returns T

    The first element of the given iterable.

  • Constructs a filter which determines whether of not a directory has a file or directory's path that passes a given test. The returned filter will arbitrarily be false for any path that isn't a directory. The path should have already been resolved.

    throws

    If the test throws an error for any of the files in the directory.

    Parameters

    • test: FilterSync<string> | Filter<string>

      The test to perform on each files' path until there is a match.

    Returns Filter<string>

    A filter which determines whether of not a directory has a file or directory's path that passes a given test.

  • Constructs a filter which determines whether of not a directory has a file or directory's path that passes a given test. The returned filter will arbitrarily be false for any path that isn't a directory. The path should have already been resolved.

    throws

    If the test throws an error for any of the files in the directory.

    Parameters

    • test: FilterSync<string>

      The test to perform on each files' path until there is a match.

    Returns FilterSync<string>

    A filter which determines whether of not a directory has a file or directory's path that passes a given test.

  • hasPathSegments(...tests: SegmentTester[]): FilterSync<string>
  • Constructs a filter which determines whether or not all the path segments of a path pass a sequence of tests. In order for a path to match, there must not be a path segment that fails a test. If no tests are provided, then the filter will return false regardless of the path it checks.

    throws

    If any of the tests throws an error for any path segment.

    Parameters

    • Rest ...tests: SegmentTester[]

      The sequence of tests each path segment must pass in order for the path to match.

    Returns FilterSync<string>

    A filter that determines whether or not all the path segments of a path pass a sequence of tests

  • isDirectory(element: string): Promise<boolean>
  • Safely determines whether or not the file at a given path is a directory. Is there is no file at the given path, then this returns false.

    throws

    If an I/O error different from a file not found exception occurs.

    Parameters

    • element: string

    Returns Promise<boolean>

    Whether or not the file at the given path is a directory.

  • isDirectorySync(element: string): boolean
  • Safely determines whether or not the file at a given path is a directory. Is there is no file at the given path, then this returns false.

    throws

    If an I/O error different from a file not found exception occurs.

    Parameters

    • element: string

    Returns boolean

    Whether or not the file at the given path is a directory.

  • isFile(element: string): Promise<boolean>
  • Safely determines whether or not the file at a given path is a file. Is there is no file at the given path, then this returns false.

    throws

    If an I/O error different from a file not found exception occurs.

    Parameters

    • element: string

    Returns Promise<boolean>

    Whether or not the file at the given path is a file.

  • isFileSync(element: string): boolean
  • Safely determines whether or not the file at a given path is a file. Is there is no file at the given path, then this returns false.

    throws

    If an I/O error different from a file not found exception occurs.

    Parameters

    • element: string

    Returns boolean

    Whether or not the file at the given path is a file.

  • ofBasename(...tests: SegmentTester[]): FilterSync<string>
  • Constructs a filter which determines whether or not a given path has a base name matching a given full base name, a regular expression or a function. If a path's base name is equal to any of the given string base names, or if it matches with any of the regular expressions, or if any of the base name functions returns true, then the filter returns true.

    throws

    If a test function throws an error as it is being run.

    Parameters

    • Rest ...tests: SegmentTester[]

      The set of tests run on the paths to check.

    Returns FilterSync<string>

    A filter which determines whether or not a given path has a base name matching a given full base name, a regular expression or a function.

  • ofDirname(...tests: SegmentTester[]): FilterSync<string>
  • Constructs a filter which determines whether or not a given path has a directory name matching a given full directory name, a regular expression or a function. If a path's directory name is equal to any of the given string directory names, or if it matches with any of the regular expressions, or if any of the directory name functions returns true, then the filter returns true.

    throws

    If any of the test functions throws an error.

    Parameters

    • Rest ...tests: SegmentTester[]

      The set of tests run on the paths to check.

    Returns FilterSync<string>

    A filter which determines whether or not a given path has a directory name matching a given full directory name, a regular expression or a function.

  • ofExtname(...tests: SegmentTester[]): FilterSync<string>
  • Constructs a filter which determines whether or not a given path has an extension name matching a given full extension name, a regular expression or a function. If a path's extension name is equal to any of the given string extension names, or if it matches with any of the regular expressions, or if any of the extension name functions returns true, then the filter returns true.

    throws

    If any of the test functions throws an error.

    Parameters

    • Rest ...tests: SegmentTester[]

      The set of tests run on the paths to check.

    Returns FilterSync<string>

    A filter which determines whether or not a given path has an extension name matching a given full extension name, a regular expression or a function.

  • ofName(...tests: SegmentTester[]): FilterSync<string>
  • Constructs a filter which determines whether or not a given path has a name matching a given full name, a regular expression or a function. The name of a path corresponds to its base name without its extension name. If a path's name is equal to any of the given string names, or if it matches with any of the regular expressions, or if any of the name functions returns true, then the filter returns true.

    throws

    If a test function throws an error as it is being run.

    Parameters

    • Rest ...tests: SegmentTester[]

      The set of tests run on the paths to check.

    Returns FilterSync<string>

    A filter which determines whether or not a given path has a base name matching a given full base name, a regular expression or a function.

  • onlyElement<T>(iterable: Iterable<T> | AsyncIterable<T>): Promise<T>
  • Retrieves the first and only element of an iterable.

    throws

    If there is more than one element in the iterable.

    Type parameters

    • T

      The type of iterated elements.

    Parameters

    • iterable: Iterable<T> | AsyncIterable<T>

      The iterable from which to retrieve the first and only element.

    Returns Promise<T>

    The first and only element of the given iterable.

  • onlyElementSync<T>(iterable: Iterable<T>): T
  • Retrieves the first and only element of an iterable.

    throws

    If there is more than one element in the iterable.

    Type parameters

    • T

      The type of iterated elements.

    Parameters

    • iterable: Iterable<T>

      The iterable from which to retrieve the first and only element.

    Returns T

    The first and only element of the given iterable.

  • readdir(directory: string): AsyncIterable<string>
  • Constructs a generator which yields the files read asynchronously from the given directory's path. The files are not yielded in any particular order.

    throws

    If the given directory's path is a file.

    throws

    If the given directory's path is inexistant.

    Parameters

    • directory: string

      The path to the directory to read. If it is not absolute, then it is resolved relative to the current working directory.

    Returns AsyncIterable<string>

    An iterable over the read files of the given directory's path.

  • readdirSync(directory: string): Iterable<string>
  • Constructs a generator which yields the files read synchronously from the given directory's path. The files are not yielded in any particular order.

    throws

    If the given directory's path is a file.

    throws

    If the given directory's path is inexistant.

    Parameters

    • directory: string

      The path to the directory to read. If it is not absolute, then it is resolved relative to the current working directory.

    Returns Iterable<string>

    An iterable over the read files of the given directory's path.

  • readdirs(directories: Iterable<string> | AsyncIterable<string>): AsyncIterable<string>
  • Constructs a generator which yields the files read asynchronously from the given directory paths. The files are yielded in order of directory iterated over, but are not yielded in any particular order in each directory.

    throws

    If any of the given directory's path is a file.

    throws

    If any of the given directory's path is inexistant.

    Parameters

    • directories: Iterable<string> | AsyncIterable<string>

      The paths to the directories to read. If any of them is not absolute, then it is resolved relative to the current working directory.

    Returns AsyncIterable<string>

    An iterable over the read files of the given directory paths.

  • readdirsSync(directories: Iterable<string>): Iterable<string>
  • Constructs a generator which yields the files read synchronously from the given directory paths. The files are yielded in order of directory iterated over, but are not yielded in any particular order in each directory.

    throws

    If any of the given directory's path is a file.

    throws

    If any of the given directory's path is inexistant.

    Parameters

    • directories: Iterable<string>

      The paths to the directories to read. If any of them is not absolute, then it is resolved relative to the current working directory.

    Returns Iterable<string>

    An iterable over the read files of the given directory paths.

  • segments(path: string): Iterable<string>
  • Constructs a generator which yields the segments of a path. These segments are based off the normalized path, which may or may not be absolute. Each yielded segment must have at least one non-special character, meaning that a segment cannot consist solely of dots or segment separators.

    Parameters

    • path: string

      The path from which to yield the segments.

    Returns Iterable<string>

    An iterable over the segments of the normalized path.

  • upwardDirectories(): AsyncIterable<string>
  • upwardDirectories(startPath: string): AsyncIterable<string>
  • upwardDirectories(startPath: string, maximumHeight: number): AsyncIterable<string>
  • upwardDirectories(startPath: string, endPath: string): AsyncIterable<string>
  • Constructs an iterable over the upward directories starting from the current working directory. The current working directory is not yielded. The directories are yielded in ascending order of height relative to the current working directory.

    Returns AsyncIterable<string>

    An iterable over the upward directories.

  • Constructs an iterable over the upward directories starting from the given path. The start path is not yielded. If the start path is a file, then its directory is yielded. The directories are yielded in ascending order of height relative to the given start path.

    Parameters

    • startPath: string

      The start path from which to traverse upwards.

    Returns AsyncIterable<string>

    An iterable over the upward directories.

  • Constructs an iterable over the upward directories starting from the given path and up to a given maximum height. The start path is not yielded. If the start path is a file, then its directory is yielded. The directories are yielded in ascending order of height relative to the given start path. Each yielded directory has a height greater than one, and less than or equal to the given maximum height.

    Parameters

    • startPath: string

      The start path from which to traverse upwards.

    • maximumHeight: number

      The maximum height of any yielded directory path.

    Returns AsyncIterable<string>

    An iterable over the upward directories.

  • Constructs an iterable over the upward directories starting from the given path and up to a given end path. The start path is not yielded. If the start path is a file, then its directory is yielded. The directories are yielded in ascending order of height relative to the given start path. If the end path is not parent to the start path, then the iteration ends with the root of the start path. The iteration has to encounter the end path in order to end once it is yielded.

    Parameters

    • startPath: string

      The start path from which to traverse upwards.

    • endPath: string

      The path on which the iteration will end if it is encountered in the upward traversal.

    Returns AsyncIterable<string>

    An iterable over the upward directories.

  • upwardDirectoriesSync(): Iterable<string>
  • upwardDirectoriesSync(startPath: string): Iterable<string>
  • upwardDirectoriesSync(startPath: string, maximumHeight: number): Iterable<string>
  • upwardDirectoriesSync(startPath: string, endPath: string): Iterable<string>
  • Constructs an iterable over the upward directories starting from the current working directory. The current working directory is not yielded. The directories are yielded in ascending order of height relative to the current working directory.

    Returns Iterable<string>

    An iterable over the upward directories.

  • Constructs an iterable over the upward directories starting from the given path. The start path is not yielded. If the start path is a file, then its directory is yielded. The directories are yielded in ascending order of height relative to the given start path.

    Parameters

    • startPath: string

      The start path from which to traverse upwards.

    Returns Iterable<string>

    An iterable over the upward directories.

  • Constructs an iterable over the upward directories starting from the given path and up to a given maximum height. The start path is not yielded. If the start path is a file, then its directory is yielded. The directories are yielded in ascending order of height relative to the given start path. Each yielded directory has a height greater than one, and less than or equal to the given maximum height.

    Parameters

    • startPath: string

      The start path from which to traverse upwards.

    • maximumHeight: number

      The maximum height of any yielded directory path.

    Returns Iterable<string>

    An iterable over the upward directories.

  • Constructs an iterable over the upward directories starting from the given path and up to a given end path. The start path is not yielded. If the start path is a file, then its directory is yielded. The directories are yielded in ascending order of height relative to the given start path. If the end path is not parent to the start path, then the iteration ends with the root of the start path. The iteration has to encounter the end path in order to end once it is yielded.

    Parameters

    • startPath: string

      The start path from which to traverse upwards.

    • endPath: string

      The path on which the iteration will end if it is encountered in the upward traversal.

    Returns Iterable<string>

    An iterable over the upward directories.

  • upwardFiles(): AsyncIterable<string>
  • upwardFiles(maximumHeight: number): AsyncIterable<string>
  • upwardFiles(startPath: string): AsyncIterable<string>
  • upwardFiles(startPath: string, maximumHeight: number): AsyncIterable<string>
  • upwardFiles(startPath: string, endDirectory: string): AsyncIterable<string>
  • Constructs an iterable over the files in the upward directories relative to the current working directory, up to the root inclusively of the current working directory. The directories are traversed in increasing order of height relative to the start directory. The start directory is not read.

    Returns AsyncIterable<string>

    An iterable over the upward files.

  • Constructs an iterable over the files in the upward directories relative to the current working directory, up to the upward directory whose height relative to the current working directory is equal to the given maximum height. The directories are traversed in increasing order of height relative to the start directory. The start directory is not read.

    Parameters

    • maximumHeight: number

      The maximum height of a directory. The height of the start directory is zero. This value should be greater than or equal to one.

    Returns AsyncIterable<string>

    An iterable over the upward files.

  • Constructs an iterable over the files in the upward directories relative to the start path, up to the root inclusively of the start path directory. The directories are traversed in increasing order of height relative to the start directory. The start path is not read if it is a directory. If the start path is a file, then its directory is the first directory to be read.

    Parameters

    • startPath: string

      The start path of the upward traversal.

    Returns AsyncIterable<string>

    An iterable over the upward files.

  • Constructs an iterable over the files in the upward directories relative to the start path, up to the upward directory whose height relative to the start path is equal to the given maximum height. The directories are traversed in increasing order of height relative to the start directory. The start path is not read if it is a directory. If the start path is a file, then its directory is the first directory to be read, if its height does not exceed the maximum height.

    Parameters

    • startPath: string

      The start path of the upward traversal.

    • maximumHeight: number

      The maximum height of a directory. The height of the start path is zero. This value should be greater than or equal to one.

    Returns AsyncIterable<string>

    An iterable over the upward files.

  • Constructs an iterable over the files in the upward directories relative to the start path, up to an end path. The directories are traversed in increasing order of height relative to the start directory. The start path is not read if it is a directory. If the start path is a file, then its directory is the first directory to be read. If the end directory is not parent to the start path, then all the upward paths from the start path are yielded up to its root. The iteration stops once the end directory is reached and its files are yielded.

    Parameters

    • startPath: string

      The start path of the upward traversal.

    • endDirectory: string

      The end directory at which point all the upward directories have been read.

    Returns AsyncIterable<string>

    An iterable over the upward files.

  • upwardFilesSync(): Iterable<string>
  • upwardFilesSync(maximumHeight: number): Iterable<string>
  • upwardFilesSync(startPath: string): Iterable<string>
  • upwardFilesSync(startPath: string, maximumHeight: number): Iterable<string>
  • upwardFilesSync(startPath: string, endDirectory: string): Iterable<string>
  • Constructs an iterable over the files in the upward directories relative to the current working directory, up to the root inclusively of the current working directory. The directories are traversed in increasing order of height relative to the start directory. The start directory is not read.

    Returns Iterable<string>

    An iterable over the upward files.

  • Constructs an iterable over the files in the upward directories relative to the current working directory, up to the upward directory whose height relative to the current working directory is equal to the given maximum height. The directories are traversed in increasing order of height relative to the start directory. The start directory is not read.

    Parameters

    • maximumHeight: number

      The maximum height of a directory. The height of the start directory is zero. This value should be greater than or equal to one.

    Returns Iterable<string>

    An iterable over the upward files.

  • Constructs an iterable over the files in the upward directories relative to the start path, up to the root inclusively of the start path directory. The directories are traversed in increasing order of height relative to the start directory. The start path is not read if it is a directory. If the start path is a file, then its directory is the first directory to be read.

    Parameters

    • startPath: string

      The start path of the upward traversal.

    Returns Iterable<string>

    An iterable over the upward files.

  • Constructs an iterable over the files in the upward directories relative to the start path, up to the upward directory whose height relative to the start path is equal to the given maximum height. The directories are traversed in increasing order of height relative to the start directory. The start path is not read if it is a directory. If the start path is a file, then its directory is the first directory to be read, if its height does not exceed the maximum height.

    Parameters

    • startPath: string

      The start path of the upward traversal.

    • maximumHeight: number

      The maximum height of a directory. The height of the start path is zero. This value should be greater than or equal to one.

    Returns Iterable<string>

    An iterable over the upward files.

  • Constructs an iterable over the files in the upward directories relative to the start path, up to an end path. The directories are traversed in increasing order of height relative to the start directory. The start path is not read if it is a directory. If the start path is a file, then its directory is the first directory to be read. If the end directory is not parent to the start path, then all the upward paths from the start path are yielded up to its root. The iteration stops once the end directory is reached and its files are yielded.

    Parameters

    • startPath: string

      The start path of the upward traversal.

    • endDirectory: string

      The end directory at which point all the upward directories have been read.

    Returns Iterable<string>

    An iterable over the upward files.

Generated using TypeDoc