Newer
Older
CVSS_3.0_GUI / dist / CVSS_3.0_Calc-1.0.0-linux-x64 / node_modules / nwjs-builder-phoenix / node_modules / yargs / node_modules / read-pkg-up / node_modules / find-up / node_modules / path-exists / index.js
root on 7 May 2019 466 bytes Initial commit
'use strict';
var fs = require('fs');
var Promise = require('pinkie-promise');

module.exports = function (fp) {
	var fn = typeof fs.access === 'function' ? fs.access : fs.stat;

	return new Promise(function (resolve) {
		fn(fp, function (err) {
			resolve(!err);
		});
	});
};

module.exports.sync = function (fp) {
	var fn = typeof fs.accessSync === 'function' ? fs.accessSync : fs.statSync;

	try {
		fn(fp);
		return true;
	} catch (err) {
		return false;
	}
};