web-ext-run
Version:
A tool to open and run web extensions
20 lines (19 loc) • 495 B
JavaScript
import fs from 'fs/promises';
import { onlyErrorsWithCode } from '../errors.js';
/*
* Resolves true if the path is a readable directory.
*
* Usage:
*
* isDirectory('/some/path')
* .then((dirExists) => {
* // dirExists will be true or false.
* });
*
* */
export default function isDirectory(path) {
return fs.stat(path).then(stats => stats.isDirectory()).catch(onlyErrorsWithCode(['ENOENT', 'ENOTDIR'], () => {
return false;
}));
}
//# sourceMappingURL=is-directory.js.map