Project

pbio

0.0
Low commit activity in last 3 years
No release in over a year
Protobuf Streaming
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

PB IO

Test License

Protobuf IO is a Ruby equivalent of https://godoc.org/github.com/gogo/protobuf/io.

Installation

Add gem 'pbio' to your Gemfile.

Usage

File.open("file.txt", "w") do |f|
  pbio = PBIO::Delimited.new(f)
  pbio.write MyProtoMsg.new(title: "Foo")
  pbio.write MyProtoMsg.new(title: "Bar")
end

File.open("file.txt", "r") do |f|
  pbio = PBIO::Delimited.new(f)
  pbio.read MyProtoMsg # => #<MyProtoMsg: title: "Foo">
  pbio.read MyProtoMsg # => #<MyProtoMsg: title: "Bar">
  pbio.read MyProtoMsg # => nil
  f.eof?               # => true
end