📦
clib Data Formats
protobuf
Protocol Buffers serialization using libprotobuf. Serialize structured data to compact binary wire format and deserialize it back.
Install ppm install protobuf
Usage Example
uses protobuf; var msg := Create; SetString(msg, 1, 'Alice'); // field 1 = name SetInt(msg, 2, 30); // field 2 = age SetString(msg, 3, 'alice@example.com'); // field 3 // Serialize to binary var bytes := Serialize(msg); WriteLn('Size: ' + IntToStr(Length(bytes)) + ' bytes'); // Deserialize var msg2 := Deserialize(bytes); WriteLn(GetString(msg2, 1)); // Alice WriteLn(IntToStr(GetInt(msg2, 2))); // 30
Features
Compact binary wire format
Field number-based schema
String, integer and bytes fields
Serialize to byte array
Deserialize from byte array
← Back to Package Index