GT2/GT2-iOS/node_modules/exists-async/index.js

18 lines
372 B
JavaScript

var fs = require('fs');
module.exports = function (pth) {
return new Promise(function (resolve, reject) {
fs.access(pth, fs.F_OK, function (err, result) {
if (err) {
if (err.toString().match(/^Error: ENOENT:/)) {
resolve(false);
} else {
reject(err);
}
} else {
resolve(true);
}
});
});
}