serverless/lib/utils/fs/dir-exists.js
2024-05-29 11:51:04 -04:00

16 lines
278 B
JavaScript

import { promises as fsp } from 'fs'
async function dirExists(path) {
return fsp.lstat(path).then(
(stats) => stats.isDirectory(),
(error) => {
if (error.code === 'ENOENT') {
return false
}
throw error
},
)
}
export default dirExists