lib/index.js
function fileExists(path, shouldBeDir) {
    "use strict";
    try {
        var lstat = fs.lstatSync(path);
        if (shouldBeDir && lstat.isDirectory()) {
            return true;
        }
        if (!shouldBeDir && lstat.isFile()) {
            return true;
        }
    } catch (err) {
        return false;
    }
    return false;
}
function fileExists(path, shouldBeDir) {
    "use strict";
    try {
        var lstat = fs.lstatSync(path);
        if (shouldBeDir && lstat.isDirectory()) {
            return true;
        }
        if (!shouldBeDir && lstat.isFile()) {
            return true;
        }
    } catch (err) {
        return false;
    }
    return false;
}
function fileExists ( path , shouldBeDir ) { "use strict" ; try { var lstat = fs . lstatSync ( path ) ; if ( shouldBeDir && lstat . isDirectory ( ) ) { return true ; } if ( ! shouldBeDir && lstat . isFile ( ) ) { return true ; } } catch ( err ) { return false ; } return false ; }
Checks synchroniously if given file or directory exists. Returns true or false.
@param {string}  path        - Path of the file or directory.
@param {boolean} shouldBeDir - Whether given path should be directory.
@returns {boolean}
@private
Checks synchroniously if given file or directory exists . Returns true or false .