subtree-hooks
    Preparing search index...

    Interface Options<CustomNode, CustomStatsData, CustomSubFile>

    Configuration options for SubtreeHooks. Provides callbacks that are invoked during directory traversal.

    The shape of the custom tree used in the traversal.

    The shape of the metadata object passed to callbacks.

    interface Options<
        CustomNode extends Node,
        CustomStatsData extends OnStatsData<CustomNode>,
        CustomSubFile extends SubFileData<CustomNode>,
    > {
        onDirStats(data: CustomStatsData, callback: () => void): unknown;
        onFileStats(data: CustomStatsData, callback: () => void): unknown;
        onSubTree(
            data: CustomSubFile,
            next: () => void,
            abort: () => void,
        ): unknown;
    }

    Type Parameters

    Index

    Methods

    • Called for each directory after its fs.Stats have been retrieved.

      Parameters

      • data: CustomStatsData

        Metadata about the directory, including paths, stats, and current tree node.

      • callback: () => void

        Must be called to continue traversal of the subtree.

      Returns unknown

    • Called for each file after its fs.Stats have been retrieved.

      Parameters

      • data: CustomStatsData

        Metadata about the file, including paths, stats, and current tree node.

      • callback: () => void

        Must be called to continue processing.

      Returns unknown

    • Called when a directory's subtree is ready to be processed. Allows control over whether the subtree is traversed.

      Parameters

      • data: CustomSubFile

        Metadata about the directory, including paths, and owner directory tree node.

      • next: () => void

        Call this to continue processing the subtree.

      • abort: () => void

        Optionally call this to skip processing this subtree.

      Returns unknown