Skip to content

Provide the ability to write to existing typed arrays #503

Open
@nex3

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    WishlistThings we'd want in the future

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions