(buffer: Uint8Array | undefined | null)
| 21 | * @returns Will be `null` if neither `filename` nor `buffer` were provided. Otherwise will be a boolean value with the detection result. |
| 22 | */ |
| 23 | export function isText(buffer: Uint8Array | undefined | null): boolean { |
| 24 | // Fallback to encoding if extension check was not enough |
| 25 | if (!buffer || typeof buffer !== "object") return false; |
| 26 | return getEncoding(buffer) === "utf8"; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Get the encoding of a buffer. |
no test coverage detected