2.1.1 • Published 10 years ago

pull-varstruct v2.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

pull-varstruct

stream encode/decode varstructs

example

var varstruct = require('varstruct')
var pv = require('pull-varstruct')

var struct = varstruct({
  //32 bit Big Engian integer
  id: varstruct.UInt32,
  //a buffer 0 - 255 bytes long
  name: varstruct.varbuf(varstruct.byte)
})

//if duplex is a tcp, etc stream, that we want to write
//object to.
function serialize(duplex) {
  return pv.duplex(duplex, struct)
}

api

pv(stream, codec)

take a duplex object stream and return an binary duplex stream, encoded/decoded with codec.

pv.encode(codec)

transform stream that takes an object stream and outputs a binary stream.

pv.decode(codec)

transform stream that takes a binary stream and outputs an object stream.

License

MIT

2.1.1

10 years ago

2.1.0

10 years ago

2.0.0

10 years ago

1.0.1

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago