()
| 62 | } |
| 63 | |
| 64 | export function getStdinAsString(): Promise<string> { |
| 65 | let result = '' |
| 66 | return new Promise(resolve => { |
| 67 | process.stdin.setEncoding('utf-8') |
| 68 | process.stdin.on('readable', () => { |
| 69 | let chunk |
| 70 | while ((chunk = process.stdin.read())) { |
| 71 | result += chunk |
| 72 | } |
| 73 | }) |
| 74 | process.stdin.on('end', () => { |
| 75 | resolve(result) |
| 76 | }) |
| 77 | }) |
| 78 | } |