Boilerplate generator and deno tasks for monorepo
This commit is contained in:
15
lib/fileExists.ts
Normal file
15
lib/fileExists.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user