min-stream-pkt-line
A pkt-line codec packaged as maps and min-stream push-filters.
This is a component of the js-git project.
Usage
This module exports 4 functions. There are two maps and two push-filters.
var pktLine = ; // Assuming source, app, and sink already exist, here is one way to insert the// framing and deframing into the stream.helpers;
The map functions are used directly as needed and not applied to the stream as a whole.
pktLine.encode(data, caps, request) -> buffer
A map function that encodes the data portion of pkt-lines
pktLine.decode(buffer) -> data
A map function that decodes the data portion of pkt-lines.
pktLine.deframer(emit) -> emit
A push-filter that consumes arbitrary sized buffers and outputs deframed message buffers.
The flush message is encoded as null
If the stream transitions to raw PACK mode, a true
event is emitted to signify the transition.
pktLine.framer(emit) -> emit
A map function that accepts a buffer and returns a framed buffer.
Pass in null
to encode a flush frame.
Pass in true
to set the mode to raw PACK mode.