Drop-in replacement for `fs.existsSync` with zero dependencies. Other libs I found either have crucial differences from fs.existsSync, or unnecessary dependencies. See README.md for more info.
npm install fs-exists-sync> Drop-in replacement for fs.existsSync with zero dependencies. Other libs I found either have crucial differences from fs.existsSync, or unnecessary dependencies. See README.md for more info.
``sh`
$ npm install fs-exists-sync --save
`js
var exists = require('fs-exists-sync');
console.log(exists('.'));
//=> true
console.log(exists(process.cwd()));
//=> true
console.log(exists('README.md'));
//=> true
console.log(exists('foo.txt'));
//=> false
console.log(exists(''));
//=> false
console.log(exists());
//=> false
`
I just want a _simple replacement for fs.existsSync_. Here is what I found:
- [path-exists][]: Has dependencies to support a promises API
- [fs-exists][]: async only
- [file-exists][]: returns false if the path exists but is a directory.fs
- [exists][]: nothing to do with .
You might also be interested in these projects:
* is-absolute: Polyfill for node.js path.isAbolute. Returns true if a file path is absolute. | homepagepath.parse
* parse-filepath: Pollyfill for node.js , parses a filepath into an object. | homepage
* try-open: Tries to open a file using fs.openSync (only necessary with sync), fails gracefully if the… more | homepage
`sh`
$ npm install verb && npm run docs
Or, if [verb][] is installed globally:
`sh`
$ verb
`sh``
$ npm install -d && npm test
+ github/jonschlinkert
+ twitter/jonschlinkert
*
_This file was generated by verb, v0.9.0, on April 09, 2016._
[verb]: https://github.com/verbose/verb
[path-exists]: https://github.com/sindresorhus/path-exists
[fs-exists]: https://github.com/meryn/fs-exists
[file-exists]: https://github.com/scottcorgan/file-exists
[exists]: https://github.com/tjmehta/exists