function pathExists (path, options) {
  options = options || {
    returnFile: false
  };

  // Defaults to F_OK
  return nodeCall(fs.access, path)
    .then(function () {
      return options.returnFile ? path : true;
    })
    .catch(function () {
      if (fs.existsSync(path)) {
        return options.returnFile ? path : true;
      }
      return false;
    });
}
function pathExists (path, options) {
  options = options || {
    returnFile: false
  };

  // Defaults to F_OK
  return nodeCall(fs.access, path)
    .then(function () {
      return options.returnFile ? path : true;
    })
    .catch(function () {
      if (fs.existsSync(path)) {
        return options.returnFile ? path : true;
      }
      return false;
    });
}
function pathExists ( path , options ) { options = options || { returnFile : false } ; // Defaults to F_OK return nodeCall ( fs . access , path ) . then ( function ( ) { return options . returnFile ? path : true ; } ) . catch ( function ( ) { if ( fs . existsSync ( path ) ) { return options . returnFile ? path : true ; } return false ; } ) ; }
Check if a path exists.

@param {String} path - The full path to the file to check.
@param {Object} [options] - fileExists options.
@param {Boolean} [options.returnFile] - If true, resolve to input filename on
success. Otherwise, resolve to boolean. Defaults to false (boolean).
@returns {Promise} Resolves to true (or file) if exists, false otherwise.
Check if a path exists .