JSPM

file-exists-safe

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4669
  • Score
    100M100P100Q130864F
  • License MIT

Check if a file exists without a try catch

Package Exports

  • file-exists-safe

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (file-exists-safe) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

file-exists-safe

NPM TypeScript Coverage Status GitHub Stars Twitter Follow

Check if a file exists without a 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 for 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