Skip to content
Functionutils/nodev0.8.17

traverseDirectory

Recursively traverses through a directory, importing all .ts and .js files and applying a callback to each import.

Throws:

  • A SeedcordError when a directory cannot be read or a file throws while importing.

async traverseDirectory(
    dir: string,
    callback: (
        fullPath: string,
        relativePath: string,
        imported: Record<string, unknown>
    ) => Promise<void> | void
): Promise<void>