chore(*): use @moeru/std & cleanup code, rename

This commit is contained in:
Neko Ayaka
2025-06-23 15:34:07 +08:00
parent ae98a39d8a
commit 50e05b114b
28 changed files with 55 additions and 192 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
}