()
| 23 | } |
| 24 | |
| 25 | function readStdin(): Promise<string> { |
| 26 | return new Promise((resolve, reject) => { |
| 27 | const chunks: Buffer[] = []; |
| 28 | process.stdin.setEncoding('utf8'); |
| 29 | process.stdin |
| 30 | .on('data', chunk => chunks.push(chunk)) |
| 31 | .on('end', () => { |
| 32 | const result = chunks.join(''); |
| 33 | resolve(result); |
| 34 | }) |
| 35 | .on('error', error => { |
| 36 | reject(error); |
| 37 | }); |
| 38 | }); |
| 39 | } |