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.
23 lines
347 B
23 lines
347 B
'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;
|
|
}
|
|
};
|
|
|