async function exists(filepath) {
  return fs
    .stat(filepath)
    .then(() => true)
    .catch((err) => {
      if (err instanceof Error && 'code' in err && err.code === 'ENOENT') {
        return false
      } else {
        throw err
      }
    })
}
Checks if a file or directory exists.
@param {string} filepath - The path to check.
@returns {Promise<boolean>} - True if the file exists, false otherwise.