filedel
Version:
25 lines (20 loc) • 395 B
JavaScript
/**
* @function isDir
* @returns {Promise}
*/
const {existsAsync, statAsync} = require('asfs')
/** @lends isDir */
async function isDir (filename) {
const exists = await existsAsync(filename)
if (!exists) {
return
}
try {
const stats = await statAsync(filename)
return stats.isDirectory()
} catch (e) {
// Ignore error.
}
}
module.exports = isDir