(response: JsonRpcResponse)
| 76 | const decoder = new TextDecoder(); |
| 77 | |
| 78 | function encodeResponse(response: JsonRpcResponse): Uint8Array { |
| 79 | const body = JSON.stringify(response); |
| 80 | const header = `Content-Length: ${Buffer.byteLength(body)}\r\n\r\n`; |
| 81 | return encoder.encode(header + body); |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Read exactly `n` bytes from stdin. |