Skip to main content

recursiveReadDir

Callable

  • recursiveReadDir(dir: string, skipDirectories?: string[], allowedExtensions?: string[]): string[]

  • @example
    const { reacursiveReadDir } = require('skyhelper-utils');

    const files = recursiveReadDir('src/commands');
    const commands = [];
    files.forEach((file) => {
    const command = require(file);
    commands.push(command.data.name, command);
    });

    Parameters

    NameTypeDefaultDescription
    dirstring

    the directory to read (from the root directory)

    skipDirectoriesstring[] = []

    The directories/sub-directories to skip

    allowedExtensionsstring[] = ...

    extension of the files to read

    Returns string[]