mafintosh/debug-stream — pull request #1 by alessioalex (2014-08-11 10:51:49+00:00)
Title: fix the encoding issue with through2

related to https://github.com/rvagg/through2/issues/14

I don't have time to debug further again and see what's what, but the thing is some messages are lost without this fix.

Consider the following example:

```js
process.env.DEBUG = 'test'

var debugStream = require('./')('test')
var net = require("net")
var MessageStream = require("irc-message-stream");

var messageStream = new MessageStream

messageStream.on("line", function(line) {
console.log("Got raw line: " + line)
})

messageStream.on("data", function(message) {
console.log("Got parsed message: " + JSON.stringify(message))
})

var freenode_conn = net.connect(6667, "orwell.freenode.net")
freenode_conn.pipe(messageStream).pipe(debugStream())

setTimeout(function() {
freenode_conn.write('NICK debugStreamBot\r\n')
freenode_conn.write("USER debugStreamUser 8 * :debugStreamRn\r\n")
}, 3000)
```

to run it do:

```bash
npm i martynsmith/node-irc
node example.js
```

Now run the same example with my fix.
The second time the output should be bigger and you will notice the MOTD (message of the day) is present.

As I said, sorry I didn't have time to figure out what the exact problem again, but it has to do with node core.