Updated to use streams.Duplex instead of old-style stream. Requires Node.js >= 0.10.0.