()
| 2814 | // Pause between parts so the server reads them separately. |
| 2815 | const parts = typeof input === "string" ? [input] : [...input] |
| 2816 | const writeNext = () => { |
| 2817 | const part = parts.shift()! |
| 2818 | if (parts.length === 0) return socket.end(part) |
| 2819 | socket.write(part) |
| 2820 | setTimeout(writeNext, 50) |
| 2821 | } |
| 2822 | socket.on("connect", writeNext) |
| 2823 | socket.on("data", (data) => { |
| 2824 | stream = Buffer.Buffer.concat([stream, Buffer.Buffer.from(data)]) |