(buffer)
| 23 | } |
| 24 | |
| 25 | export function isProbablyText(buffer) { |
| 26 | const sample = buffer.subarray(0, Math.min(buffer.length, 4096)); |
| 27 | for (const value of sample) { |
| 28 | if (value === 0) { |
| 29 | return false; |
| 30 | } |
| 31 | } |
| 32 | return true; |
| 33 | } |
| 34 | |
| 35 | export function readStdinIfPiped() { |
| 36 | if (process.stdin.isTTY) { |
no outgoing calls
no test coverage detected