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.
Install with npm:
$ npm install fs-exists-sync --save
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:
false
if the path exists but is a directory.fs
.You might also be interested in these projects:
path.isAbolute
. Returns true if a file path is absolute. | homepagepath.parse
, parses a filepath into an object. | homepagePull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Generate readme and API documentation with verb:
$ npm install verb && npm run docs
Or, if verb is installed globally:
$ verb
Install dev dependencies:
$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb, v0.9.0, on April 09, 2016.