feat(cli-tools): Binary publish#3282
Merged
Merged
Conversation
juslesan
approved these changes
Dec 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a
--binaryflag to thestream subscribeandstream publishcommands. When this flag is enabled, the commands read and write binary bytes instead of normal JSON or hex strings. If the--with-metadataflag is also used, the bytes represent the protobuf-encodedStreamMessageobjects.All messages use a length-prefixed frame format: each item is prefixed with a 4-byte header indicating the frame length.
A new
--rawflag was added tostream publish, allowing protobuf binary messages to be sent exactly as provided. Currently this flag is supported only when both--binaryand--with-metadataare used, since raw publishing requiresStreamMessageobjects as input.Helpers
These existing helpers may be useful when working with the new features introduced in this PR:
convertStreamMessageToBytes()andconvertBytesToStreamMessage()from@streamr/sdkcan be used to convert betweenStreamMessageobjects and their protobuf byte formtoLengthPrefixedFrame()andLengthPrefixedFrameDecoderfrom@streamr/utilscan be used to create and parse length-prefixed framesRelated changes
Added
MessageSignerexport to the SDK. This class is required instream-publish.test.ts.Refactored the CLI tool’s
startCommandtest utilities so that they can capture either text or binary output.Future improvements
We could support
--rawpublishing without the--binaryflag by constructingStreamMessageinstances directly in the CLI tool. Seestream-publish.test.tsfor an example of how to create messages.