fsep
Version:
Fsep is a library that promisifies the native node FS operation and brings extras into the mix.
22 lines (16 loc) • 308 B
JavaScript
;
const Fs = require('fs');
const Util = require('util');
const Stat = Util.promisify(Fs.stat);
module.exports = async function Exist (path) {
try {
await Stat(path);
return true;
} catch (error) {
if (error.code === 'ENOENT') {
return false;
} else {
throw error;
}
}
};