$ gnpm install file-exists-safe
Check if a file exists without try catch.
If I should maintain this repo, please ⭐️
DM me on Twitter if you have questions or suggestions.
Check if a file exists without try catch.
true
if the path exists and is a file.false
if the path is not a file, or does not exist.undefined
on other errors (for example, permission denied) rather than throwing.yarn add file-exists-safe
npm install file-exists-safe
pnpm add file-exists-safe
import { fileExists, fileExistsSync, Options } from "file-exists-safe";
function fileExists(path: string, options?: Options): Promise<boolean | undefined>;
function fileExistsSync(path: string, options?: Options): boolean | undefined;
type Options = {
/**
* Return true if path is directory. Default: `false`
*/
includeDirectories?: boolean;
};
Copyright 2013 - present © cnpmjs.org | Home |