Split up a capnp stream into its individual messages.
npm i --save capnp-split
yarn add capnp-split
const CapnpStream = ;var msgStream = ;msgStream;fs;
new CapnpStream() =>
Creates a new writable stream that takes in buffers and emits a
message event whenever a whole capnp message is readable. Buffers the rest for the next chunk of data.
CapnpStream.readSize(buff, offset) =>
Read the total size of the message starting at
offset. This method does not esure that the buffer is long enough to contain the message.
Buffer) The buffer to look at for the size information
Number) Defaults to 0. An offset position in bytes to read the size data from.
CapnpStream.readMessage(buff, offset) =>
Read the actual message starting at
offset. The result buffer will be a
.slice of the original, meaning the data will not be copied and modifications made to the result will affect the original buffer.
Buffer) The buffer containing the message data
Number) Defaults to 0. An offset position in bytes to read the data from.