chore: cleanup

Signed-off-by: Neko Ayaka <neko@ayaka.moe>
This commit is contained in:
Neko Ayaka
2024-12-03 13:06:39 +08:00
parent 8fea3d0967
commit cf1f1fe038
56 changed files with 0 additions and 16234 deletions
-25
View File
@@ -1,25 +0,0 @@
import { stat } from 'node:fs/promises'
export async function exists(path: string) {
try {
await stat(path)
return true
}
catch (error) {
if (isENOENTError(error))
return false
throw error
}
}
export function isENOENTError(error: unknown): boolean {
if (!(error instanceof Error))
return false
if (!('code' in error))
return false
if (error.code !== 'ENOENT')
return false
return true
}