FridayNightFunkinBoyfriendBot/util/file-exists.js

16 lines
247 B
JavaScript
Raw Permalink Normal View History

2023-12-17 14:55:27 -05: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