-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Protocol Buffers Handbook
By :

Now, we will start to see flags that are important for learning Protobuf and inspecting the serialized data. We will start with the flag called --encode
.
As its name suggests, the --encode
flag is used to encode data. It will take some data and turn it into binary (serialization). This is especially useful at this point in the book because we can inspect data without having to write code yet. We simply need protoc
and the knowledge we have on how to write in Protobuf Text Format.
Our goal in this section is not so much understanding the binary produced. We care about generating it first. In the next chapter, we will talk about the binary format. So, let us just write a simple textpb
file and encode it with the –-
encode
flag.
We will have the following textpb
file (encode/user.txtpb
):
id: 42 name: "Clément"
We will also have the following .proto
file (encode/user.proto
):
syntax = "proto3"; message User...