export const fileExists = async (path: string) => { try { await Deno.stat(path); return true; } catch (error) { if (error instanceof Deno.errors.NotFound) { // file or directory does not exist // console.log(error); return false; } else { // unexpected error, maybe permissions, pass it along throw error; } } }