chomens-bot-js/util/file-exists.js

15 lines
246 B
JavaScript
Raw Normal View History

2022-08-14 05:51:45 -04:00
const fs = require('fs/promises')
async function fileExists (filepath) {
try {
await fs.access(filepath)
return true
} catch (error) {
if (error.code !== 'ENOENT') throw error
return false
}
}
module.exports = fileExists