5.0.0 • Published 3 years ago

path-exists v5.0.0

Weekly downloads
45,002,989
License
MIT
Repository
github
Last release
3 years ago

path-exists

Check if a path exists

NOTE: fs.existsSync has been un-deprecated in Node.js since 6.8.0. If you only need to check synchronously, this module is not needed.

Never use this before handling a file though:

In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to fs.exists() and fs.open(). Just open the file and handle the error when it's not there.

Install

$ npm install path-exists

Usage

// foo.js
import {pathExists} from 'path-exists';

console.log(await pathExists('foo.js'));
//=> true

API

pathExists(path)

Returns a Promise<boolean> of whether the path exists.

pathExistsSync(path)

Returns a boolean of whether the path exists.

Related


find-upfind-babel-config@lerna/rimraf-dirweb-desktop-helperfree-minconfigcopy@wq-cli/cli@wq-cli/package@allview-cli/core@bsolution/cli@bsolution/package@megasaur/rimraf-dir@strive-cli/cli@iwz/utils@knzn/cli@knzn/package@vc-cli-dev/core@vc-cli-dev/package@essent/lerna@vic-cli-test/core@vic-cli-test/package@zml-lerna-test/core@zml-lerna-test/packagearchetype-librarybcson@cli-zx-test/core@dong-cli/core@dong-cli/package@def-builder/core@hazymoon-cli-dev/corecomponennentteasy-select-rnchinjowwchinjowvuedragdropuploadimages@cyber-tools/cyber-order@cyber-tools/lib-clipopsmart-common-authreact-native-bluetooth2killi8n-react-native-fast-imagepipihomern-send-smsspecify-importsbabel-specify-imports@icanpm/api-masterharden-cli@arisageha/react-lazyload@arisageha/react-lazyload-fixfoshata-markdown@cashremit/cr-streamline-icons@omake/react-scripts@almeidaa/ms@ultradent/nano-site-generator@cyber-tools/ns-gitreact-native-template-rfbasesalesforce-create-faux-classesqoros-gitmoji-cli@stelladoradus/stella-cliairscanairscan-examplebb-chatreact-native-esc-pos-sahaab@borisovart/atol-kkt-moduletzar-core@frxf/frxfkubii-api@willes-cli-dev/bootdeneme323112@ecej-cli/core@texttree/demo-bsa-reference-rcl@fundefund/funde_ck@ntt_app/react-native-custom-notificationwenke-babel-corereact-native-custom-text-hwjames@sonammalhotra/lotide@form-cli-dev/package@form-cli-dev/core@smishra17/lotide@cheapthrills/lotide@form-cli-dev/packaget@form-cli-dev/coretreact-native-covid-sdkgql_din_mod@zxy-cli/cliinotifywait-pathbitgetzetan-test-testalex-frontend-sdk-stagingafryxiconsreact-native-thanh-toast-librarymutasi-bcasalut_gongjang_first_module@jttechnic/interpreter@samuel-template-cli/core@samuel-template-cli/package@thanhnguyen14797/react-native-thanh-toast-library@suanlafen/core@rp-cli/coresparrow-bird-server@l1nyanm1ng/react-picture-viewer
5.0.0

3 years ago

4.0.0

5 years ago

3.0.0

8 years ago

2.1.0

8 years ago

2.0.0

9 years ago

1.0.0

9 years ago