Open
Description
Currently the only way to access the binary serialization of a protocol buffer is using the toBinary()
method which returns its own newly-allocated Uint8Array
. If the protobuf needs to be written to a specific existing buffer, for example to include it adjacent to other data, it has to be recopied from the returned value which may be inefficient for large amounts of data or frequent transfers.
It would be great to have something like a writeToArray(array: Uint8Array, position: int = 0)
method to write directly to an existing data buffer (along with a binaryLength
getter so we can know how much space to allocate).
Activity