read-dir-safe

1.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i read-dir-safe

Weekly Downloads

355

Version

1.0.1

License

MIT

Unpacked Size

8.45 kB

Total Files

7

Last publish

Collaborators

  • bconnorwhite