()
| 11 | } |
| 12 | |
| 13 | readMessage(): JSONRPCMessage | null { |
| 14 | if (!this._buffer) { |
| 15 | return null; |
| 16 | } |
| 17 | |
| 18 | const index = this._buffer.indexOf('\n'); |
| 19 | if (index === -1) { |
| 20 | return null; |
| 21 | } |
| 22 | |
| 23 | const line = this._buffer.toString('utf8', 0, index).replace(/\r$/, ''); |
| 24 | this._buffer = this._buffer.subarray(index + 1); |
| 25 | return deserializeMessage(line); |
| 26 | } |
| 27 | |
| 28 | clear(): void { |
| 29 | this._buffer = undefined; |
no test coverage detected