• Get Files from a folder

    Type Parameters

    • Options extends {
          async?: boolean;
          recursive?: boolean;
          stat?: boolean;
      }

    Parameters

    • folder: string
    • Optional options: Options

    Returns Options["async"] extends true
        ? Promise<Options["stat"] extends true
            ? fs.Dirent[]
            : string[]>
        : Options["stat"] extends true
            ? fs.Dirent[]
            : string[]

    Example

    import { filesystem } from "@rjweb/utils"

    filesystem.getFiles('./src', { recursive: true, async: false, stat: false }) // ['./src/index.ts', ...]

    Throws

    If an fs error occurs

    Since

    1.0.0

    Supports

    nodejs