Installations
npm install path-exists
Developer
sindresorhus
Developer Guide
Module System
ESM
Min. Node Version
^12.20.0 || ^14.13.1 || >=16.0.0
Typescript Support
No
Node Version
16.2.0
NPM Version
7.10.0
Statistics
150 Stars
25 Commits
18 Forks
8 Watching
1 Branches
6 Contributors
Updated on 28 Jul 2024
Languages
JavaScript (75.56%)
TypeScript (24.44%)
Total Downloads
Cumulative downloads
Total Downloads
17,061,444,517
Last day
-7.7%
17,460,091
Compared to previous day
Last week
0.8%
102,905,498
Compared to previous week
Last month
14.9%
420,374,756
Compared to previous month
Last year
7.4%
4,248,772,438
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
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()
andfs.open()
. Just open the file and handle the error when it's not there.
Install
$ npm install path-exists
Usage
1// foo.js 2import {pathExists} from 'path-exists'; 3 4console.log(await pathExists('foo.js')); 5//=> true
API
pathExists(path)
Returns a Promise<boolean>
of whether the path exists.
pathExistsSync(path)
Returns a boolean
of whether the path exists.
Related
- path-exists-cli - CLI for this module
- path-type - Check if a path exists and whether it's a file, directory, or symlink
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
security policy file detected
Details
- Info: security policy file detected: .github/security.md:1
- Info: Found linked content: .github/security.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: .github/security.md:1
- Info: Found text in security policy: .github/security.md:1
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: license:0
- Info: FSF or OSI recognized license: MIT License: license:0
Reason
Found 6/25 approved changesets -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/path-exists/main.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/path-exists/main.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/main.yml:20
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/main.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 6 are checked with a SAST tool
Score
4.2
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More