Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

protocol-buffers-stream

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protocol-buffers-stream

Streaming protocol buffers for Node.js

Source
npmnpm
Version
0.0.0
Version published
Weekly downloads
22
-70.67%
Maintainers
1
Weekly downloads
 
Created
Source

protocol-buffers-stream

Streaming protocol buffers for Node.js

npm install protocol-buffers-stream

Usage

Assuming you have the following schema

message Test {
  required string hello = 1;
}

Run the following example

var protobufs = require('protocol-buffers-stream')
var fs = require('fs')

var schema = fs.readFileSync('schema.proto')
var createStream = protobufs(schema)

var stream = createStream()

// send a test message
stream.test({
  hello: 'world'
})

// receive a test message
stream.on('test', function(m) {
  console.log(m)
})

// just pipe to ourselves for testing
stream.pipe(stream)

Encoding

Each buffer is sent using the following encoding

----------------------------------------------
| frame length | message id | message buffer |
----------------------------------------------

The message id is the message position in the schema file (first message is 0, second is 1, etc). If you add new messages make sure to add them add the bottom of the schema file.

License

MIT

Keywords

protobuf

FAQs

Package last updated on 05 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts