I don't know of any example code for doing this with our codebase in Javascript, but I did notice that ProtoBuf.js appears to have built-in support for this via the encodeDelimited and decodeDelimited methods described here: https://github.com/dcodeIO/ProtoBuf.js/
On Mon, Oct 16, 2017 at 9:56 AM, Paolo Maria Mosconi <[email protected]> wrote: > Hi, > is there a sample node.js implementation for reading multiple streamed > messages as described in https://developers.google.com/ > protocol-buffers/docs/techniques?csw=1#stre.? > Thanks > > Il giorno giovedì 23 giugno 2011 17:55:37 UTC+2, mjs483 ha scritto: >> >> Hi, >> >> Is there any way to read a protobuf from a file input stream without >> consuming the entire file? Say for example if the file contains more >> than just one protobuf? >> >> I'd like to archive a stream of protobufs to a file for later analysis >> by simply writing them one after another to a single file with >> SerializeToOstream(&output) in C++. However according to the >> documentation, ParseFromIstream(&input) will always consume the entire >> file. Is there any way around this? Or is there not enough information >> in the encoded protobuf for this to be possible? > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
