You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
347 B
24 lines
347 B
2 weeks ago
|
'use strict';
|
||
|
const fs = require('fs');
|
||
|
const {promisify} = require('util');
|
||
|
|
||
|
const pAccess = promisify(fs.access);
|
||
|
|
||
|
module.exports = async path => {
|
||
|
try {
|
||
|
await pAccess(path);
|
||
|
return true;
|
||
|
} catch (_) {
|
||
|
return false;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
module.exports.sync = path => {
|
||
|
try {
|
||
|
fs.accessSync(path);
|
||
|
return true;
|
||
|
} catch (_) {
|
||
|
return false;
|
||
|
}
|
||
|
};
|