Wondering what’s next for npm?Check out our public roadmap! »

file-exists-safe
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Check if a file exists without try catch.

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

Installation

yarn add file-exists-safe
npm install file-exists-safe

API

import { fileExists, fileExistsSync } from "file-exists-safe";
 
function fileExists(path: string): Promise<boolean | undefined>;
 
function fileExistsSync(path: string): boolean | undefined;

Dev DependenciesDavid


License license

MIT


Related Packages

  • fs-safe: A simple fs wrapper that doesn't throw
  • dir-exists-safe: Check if a directory exists without a try catch

Install

npm i file-exists-safe

DownloadsWeekly Downloads

9

Version

1.0.2

License

MIT

Unpacked Size

5.56 kB

Total Files

7

Last publish

Collaborators

  • avatar