stream-http-header-parser
Parse HTTP header in TCP stream
Install
$ npm install --save stream-http-header-parser
Usage
const net = ;const createHeaderParser = ; net;
API
createHeaderParser(callback)
Returns a Function
that should be called with a stream.Duplex
(e.g. net.Socket
) that you want to parse.
callback(headers, stream)
Type: Function
The callback will be called after HTTP headers are parsed. headers
is an object with the actual headers
(see http-headers for details). stream
is a stream.Duplex
and it's basically a wrapper around the original stream. Note that the stream
will output all the data
from the original stream, including the headers.
Dependencies
License
MIT © Michał Nykiel