a zip code crypto-currency system good for red ONLY

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