Turns a duplex streams into an event emitter.