const { promises: Fs } = require('fs')
async function exists (path) {
try {
await Fs.access(path)
return true
} catch {
return false
}
}
// Example:
const Path = require('path')
const path = Path.join(__dirname, "existing-file.txt")
await exists(path)
// true