| 11 | * @returns {"utf-8" | "utf-16le" | "utf-16be"} |
| 12 | */ |
| 13 | const getEncoding = path => |
| 14 | ({ fffe: "utf-16le", feff: "utf-16be" })[ |
| 15 | fs.readFileSync(path).subarray(0, 2).toString("hex") |
| 16 | ] || "utf-8"; |
| 17 | |
| 18 | const ErrorCodeRegExp = new RegExp(ErrorCodes.join("|")); |
| 19 |