file-exists

5.0.1last stable release 7 years ago
Complexity Score
Low
Open Issues
N/A
Dependent Projects
279
Weekly Downloadsglobal
97,721

License

  • MIT
    • Yesattribution
    • Permissivelinking
    • Permissivedistribution
    • Permissivemodification
    • Nopatent grant
    • Yesprivate use
    • Permissivesublicensing
    • Notrademark grant

Downloads

Readme

file-exists

Check if filepath exists and is a file. Returns false for directories.

(Requires node >=6.0.0)

Install

npm install file-exists --save

Usage

const fileExists = require('file-exists');

fileExists('/index.html', (err, exists) => console.log(exists)) // OUTPUTS: true or false

fileExists('/index.html').then(exists => {
  console.log(exists) // OUTPUTS: true or false
})

const exists = await fileExists('/index.html')

console.log(fileExists.sync('/index.html')) // OUTPUTS: true or false

Options

fileExists(filepath[, options, callback])

  • filepath - the path to the file to check if it exists
  • options - an object of options
    • root - the root directory to look in (or cwd)
  • callback(err, exists) - gets called when checking is done

fileExists.sync(filepath[, options])

  • filepath - the path to the file to check if it exists
  • options - an object of options
    • root - the root directory to look in (or cwd)

Run Tests

npm install
npm test

Dependencies

No runtime dependency information found for this package.

CVE IssuesActive
0
Scorecards Score
2.00
Test Coverage
No Data
Follows Semver
Yes
Github Stars
33
Dependenciestotal
5
DependenciesOutdated
3
DependenciesDeprecated
0
Threat Modelling
No Data
Repo Audits
No Data

Learn how to distribute file-exists in your own private NPM registry

npm config set registry  https://npm.cloudsmith.com/owner/repo
Processing...
Done
npm install file-exists
Processing...
Done

10 Releases

NPM on Cloudsmith

Getting started with NPM on Cloudsmith is fast and easy.