https://github.com/bsm/pbio
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bsm/pbio
- Owner: bsm
- License: mit
- Created: 2018-05-10T15:53:40.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T18:28:21.000Z (over 1 year ago)
- Last Synced: 2025-08-04T07:58:30.428Z (10 months ago)
- Language: Ruby
- Size: 34.2 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PB IO
[](https://github.com/bsm/pbio/actions/workflows/test.yml)
[](https://opensource.org/licenses/MIT)
Protobuf IO is a Ruby equivalent of https://godoc.org/github.com/gogo/protobuf/io.
## Installation
Add `gem 'pbio'` to your Gemfile.
## Usage
```ruby
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 # => #
pbio.read MyProtoMsg # => #
pbio.read MyProtoMsg # => nil
f.eof? # => true
end
```