JSPM

file-exists-safe

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4635
  • Score
    100M100P100Q130785F
  • License MIT

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


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


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