index.js 252 B

1234567891011121314151617
  1. 'use strict';
  2. const fs = require('fs');
  3. module.exports = fp => new Promise(resolve => {
  4. fs.access(fp, err => {
  5. resolve(!err);
  6. });
  7. });
  8. module.exports.sync = fp => {
  9. try {
  10. fs.accessSync(fp);
  11. return true;
  12. } catch (err) {
  13. return false;
  14. }
  15. };