On Jun 14, 2013, at 01:01, Marco Rogers wrote:
> You've got the right idea. But you're right that it can be difficult to work out the details. I've been giving talks on this recently, and I've got a repo that may help. Check out my example gzip stream. There are slides and other examples in there that may also be helpful.
>
>
https://github.com/polotek/txjs-2013-streams-talk/blob/master/streams/gzipstream.js
>
> Keep in mind that this is an example. Don't use this for gzipping. Gzip streaming is now supported by the core zlib module in node core.
I tried to implement my transform stream following your example but I got errors. Then I tried actually running your example unmodified and I got errors too:
Server listening on port 8080
events.js:72
throw er; // Unhandled 'error' event
^
Error: stream.push() after EOF
at readableAddChunk (_stream_readable.js:146:15)
at Readable.push (_stream_readable.js:127:10)
at Transform.push (_stream_transform.js:140:32)
at Socket.readGZip (/path/to/txjs-2013-streams-talk/streams/gzipstream.js:16:12)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:408:10)
at emitReadable (_stream_readable.js:404:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
at Pipe.onread (net.js:525:21)
node 0.10.11
OS X 10.8.4