You cannot 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
JavaScript
24 lines
347 B
JavaScript
12 months 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;
|
||
|
}
|
||
|
};
|