Created
May 14, 2014 15:37
-
-
Save Unitech/ac0cb44b8d25a1f48cde to your computer and use it in GitHub Desktop.
Steam transformer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createParser () { | |
var parser = new Transform(); | |
parser._transform = function(data, encoding, done) { | |
console.log(data); | |
this.push(data); | |
done(); | |
}; | |
return parser; | |
} | |
http.createServer(function (req, resp) { | |
var dest = 'http://stackoverflow.com/'; | |
var x = request({url:dest, encoding:null}) | |
x.pipe(createParser()).pipe(resp) | |
}).listen(8000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment