headed-stream
A stream with a header! Yay!
Overview
headed-stream lets you put a length-prefixed header on a stream, for whatever weird purposes you have. I wanted to send a little bit of metadata along with a connection from a proxy; I don't know what you want to do. I'm not here to judge.
Protocol
[X(4)][Y(X)][Z...]
X: Header length (4 bytes)
Y: Header data (X bytes)
Z: Content (any following data)
Usage
var HeadedStream = net = ; net;
API
HeadedStream (constructor)
var s = ;
The HeadedStream
object is a duplex stream, so it implements all the regular
streamy things you'd expect. The only addition is the "header" event that it
emits once it's collected your headers for you.
#header
s;
License
3-clause BSD. A copy is included with the source.
Contact
- GitHub (deoxxa)
- Twitter (@deoxxa)
- Email (deoxxa@fknsrs.biz)