Created
June 4, 2014 10:53
-
-
Save watson/439478eea653aa1cba72 to your computer and use it in GitHub Desktop.
Trying to auto-resume a paused stream by piping (not working)
This file contains 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
var http = require('http'); | |
http.createServer(function (req, res) { | |
console.log('Got request'); | |
req.pause(); | |
var size = 0; | |
req.on('data', function (chunk) { | |
console.log('Counting...'); | |
size += chunk.length; | |
}); | |
req.on('end', function () { | |
console.log('Size of request:', size); | |
}); | |
console.log('Piping...'); | |
req.pipe(res); | |
}).listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment