Package Exports
- file-exists
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) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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 --saveUsage
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
})
console.log(fileExists.sync('/index.html')) // OUTPUTS: true or falseOptions
fileExists(filepath[, options, callback])
filepath- the path to the file to check if it existsoptions- an object of optionsroot- 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 existsoptions- an object of optionsroot- the root directory to look in (or cwd)
Run Tests
npm install
npm test