dir-exists-safe

1.1.0 • Public • Published

Check if a directory exists without try catch.

  • Returns true if the path exists and is a directory.
  • Returns false if the path is not a directory, or does not exist.
  • Returns undefined on other errors (for example, permission denied) rather than throwing.

Installation

yarn add dir-exists-safe
npm install dir-exists-safe

API

import { dirExists, dirExistsSync, Options } from "dir-exists-safe";

function dirExists(path: string, options?: Options): Promise<boolean | undefined>;

function dirExistsSync(path: string, options?: Options): boolean | undefined;

type Options = {
  /**
   * Return true if path is file. Default: `false`
   */
  includeFiles?: boolean;
}

Dev DependenciesDavid


License license

MIT


Related Packages

/dir-exists-safe/

    Package Sidebar

    Install

    npm i dir-exists-safe

    Weekly Downloads

    275

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    6.29 kB

    Total Files

    7

    Last publish

    Collaborators

    • bconnorwhite