-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support size-delimited messages #387
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm almost completely unable to parse the actual code, but the unit tests look nice! As long as we're following the proposal in the discussion you linked, this lgtm. (I assume that short names like enc
and dec
match the rest of the code.)
Have added the |
This release includes the following: ## Enhancements * Support size-delimited messages by @timostamm in #387. ## Bug Fixes * Upgrade to Protobuf v22.0 by @smaye81 in #394. * Fix type declaration emitting when using NodeNext module resolution by @fubhy in #398. * Strip rewrite_imports parameter by @smaye81 in #386. ## New Contributors * @s-hakase made their first contribution in #367. * @balzdur made their first contribution in #368.
This implements support for size-delimited messages described in protocolbuffers/protobuf#10229
A size-delimited message is a varint size in bytes, followed by exactly that many bytes of a message serialized with the binary format. This implementation is compatible with the counterparts in C++, Java, Go, and others.
You create such a message with
protoDelimited.enc
:With
protoDelimited.decStream
, you can parse messages from a stream. The method expects anAsyncIterable<Uint8Array>
as a stream input, so it works with Node.js streams out of the box, and can be easily adapted to other stream APIs: