Détail du package

read-dir-safe

bconnorwhite1kMIT1.0.1

Read directories recursively or non-recursively

readme


Read directories recursively or non-recursively.

  • Returns an array of relative file paths.
  • Rather than throwing, returns undefined on errors for the root directory you are reading (for example, if you try to read a directory that does not exist).

Installation

yarn add read-dir-safe
npm install read-dir-safe

API

import { readDir, readDirSync, Options } from "read-dir-safe";

function readDir(path: string, options: Options): Promise<string[] | undefined>;

function readDirSync(path: string, options: Options): string[] | undefined;

type Options = {
  /**
   * Recursively read child directories as well. Default: `true`
   */
  recursive?: boolean;
  /**
   * Whether to include directories in the results. Default: `false`
   */
  includeDirectories?: boolean;
}


Dev DependenciesDavid


License license

MIT


Related Packages

changelog

1.0.1 (2020-10-04)

1.0.0 (2020-10-03)