Function scan

  • Returns the Directory Tree of a given path. This function in synchronous.

    Type Parameters

    • Node extends Dree = Dree

      The type of the tree object, which can be extended and changed by the onFile and onDir functions.

    Parameters

    • path: string

      The path which you want to inspect

    • Optionaloptions: ScanOptions

      An object used as options of the function

    • OptionalonFile: Callback<Node>

      A function called when a file is added. It has the tree object and its stat as parameters. The object can me changed and extended here, on typescript there the function uses indeed generics.

    • OptionalonDir: Callback<Node>

      A function called when a dir is added. It has the tree object and its stat as parameters. The object can me changed and extended here, on typescript there the function uses indeed generics.

    Returns Node

    The directory tree as a Dree object