mattrobenolt/node — comment on commit 5d677cab58640591c5ef9b0a75ae849c66f77450
File: lib/zlib.js line 107
By isaacs:

This is not multibyte-safe.

Consider this:

> new Buffer([0xce, 0xa9]).toString()
'Ω'
> [new Buffer([0xce]), new Buffer([0xa9])].join('')
'??'

If a chunk splits a multibyte character, then it'll have problems. It's better to build up a single buffer, and pass that to the callback, rather than a string.

Also, the end handler should be removed if there's an error, since it is possible to emit error and then emit end later, which would be strange.