duplex transform


Streams2 syntactic sugar for making wrapping + piping duplex streams with transforms (like encoding/decoding).

npm install duplex-transform

Say you have a duplex stream, and it's super cool. Except that it speaks some protocol you don't particularly like, so you want to transform it to something else. It's a bit annoying to have to make three streams and pipe them every time. This tiny module makes this a tiny bit nicer.

This module uses + plays well with through2 and common transform stream patterns.

var dgramStream = require('dgram-stream')
var duplexTransform = require('duplex-transform')
var ugly = dgramStream('udp4')
function encode(dataencnext) {
    to: { port: 1234 }, // talking to ourselves :S 
    payload: data,
function decode(dataencnext) {
var fancy = duplexTransform.obj(encode, ugly, decode)