github-pages-deploy-action/node_modules/path-exists/index.js

18 lines
252 B
JavaScript
Raw Normal View History

2020-01-28 13:07:56 +08:00
'use strict';
const fs = require('fs');
2020-03-07 11:45:40 +08:00
module.exports = fp => new Promise(resolve => {
fs.access(fp, err => {
resolve(!err);
});
});
2020-01-28 13:07:56 +08:00
2020-03-07 11:45:40 +08:00
module.exports.sync = fp => {
2020-01-28 13:07:56 +08:00
try {
2020-03-07 11:45:40 +08:00
fs.accessSync(fp);
2020-01-28 13:07:56 +08:00
return true;
2020-03-07 11:45:40 +08:00
} catch (err) {
2020-01-28 13:07:56 +08:00
return false;
}
};