(error: unknown)
| 16 | } |
| 17 | |
| 18 | function isNodeErrorWithCode(error: unknown): error is Readonly<{ code: string }> { |
| 19 | if (!error || typeof error !== "object") return false; |
| 20 | const code = (error as { code?: unknown }).code; |
| 21 | return typeof code === "string"; |
| 22 | } |
| 23 | |
| 24 | async function readUtf8Slice( |
| 25 | filePath: string, |