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
  1. 'use strict';
  2. var fs = require('fs');
  3. var Promise = require('pinkie-promise');
  4.  
  5. module.exports = function (fp) {
  6. var fn = typeof fs.access === 'function' ? fs.access : fs.stat;
  7.  
  8. return new Promise(function (resolve) {
  9. fn(fp, function (err) {
  10. resolve(!err);
  11. });
  12. });
  13. };
  14.  
  15. module.exports.sync = function (fp) {
  16. var fn = typeof fs.accessSync === 'function' ? fs.accessSync : fs.statSync;
  17.  
  18. try {
  19. fn(fp);
  20. return true;
  21. } catch (err) {
  22. return false;
  23. }
  24. };
Buy Me A Coffee