lib/duplex.js
function ZDuplex(options) {
	if(options) {
		if(options.objectMode) {
			options.readableObjectMode = true;
			options.writableObjectMode = true;
		}
		if(options.readableObjectMode && options.writableObjectMode) {
			options.objectMode = true;
		}
		//Add support for iojs simplified stream constructor
		if(typeof options.read === 'function') {
			this._read = options.read;
		}
		if(typeof options.write === 'function') {
			this._write = options.write;
		}
		if(typeof options.flush === 'function') {
			this._flush = options.flush;
		}
	}
	Duplex.call(this, options);

	// Register listeners for finish (v0.10) and prefinish (v0.12) to run _duplexPrefinish
	this._duplexFinished = false;
	this.once('finish', this._duplexPrefinish.bind(this));
	this.once('prefinish', this._duplexPrefinish.bind(this));

	// note: exclamation marks are used to convert to booleans
	if(options && !options.objectMode && (!options.readableObjectMode) !== (!options.writableObjectMode)) {
		this._writableState.objectMode = !!options.writableObjectMode;
		this._readableState.objectMode = !!options.readableObjectMode;
	}
	if(options && options.readableObjectMode) {
		this._readableState.highWaterMark = 16;
	}
	if(options && options.writableObjectMode) {
		this._writableState.highWaterMark = 16;
	}
	streamMixins.call(this, Duplex.prototype, options);
	readableMixins.call(this, options);
	writableMixins.call(this, options);
}
function ZDuplex(options) {
	if(options) {
		if(options.objectMode) {
			options.readableObjectMode = true;
			options.writableObjectMode = true;
		}
		if(options.readableObjectMode && options.writableObjectMode) {
			options.objectMode = true;
		}
		//Add support for iojs simplified stream constructor
		if(typeof options.read === 'function') {
			this._read = options.read;
		}
		if(typeof options.write === 'function') {
			this._write = options.write;
		}
		if(typeof options.flush === 'function') {
			this._flush = options.flush;
		}
	}
	Duplex.call(this, options);

	// Register listeners for finish (v0.10) and prefinish (v0.12) to run _duplexPrefinish
	this._duplexFinished = false;
	this.once('finish', this._duplexPrefinish.bind(this));
	this.once('prefinish', this._duplexPrefinish.bind(this));

	// note: exclamation marks are used to convert to booleans
	if(options && !options.objectMode && (!options.readableObjectMode) !== (!options.writableObjectMode)) {
		this._writableState.objectMode = !!options.writableObjectMode;
		this._readableState.objectMode = !!options.readableObjectMode;
	}
	if(options && options.readableObjectMode) {
		this._readableState.highWaterMark = 16;
	}
	if(options && options.writableObjectMode) {
		this._writableState.highWaterMark = 16;
	}
	streamMixins.call(this, Duplex.prototype, options);
	readableMixins.call(this, options);
	writableMixins.call(this, options);
}
function ZDuplex ( options ) { if ( options ) { if ( options . objectMode ) { options . readableObjectMode = true ; options . writableObjectMode = true ; } if ( options . readableObjectMode && options . writableObjectMode ) { options . objectMode = true ; } //Add support for iojs simplified stream constructor if ( typeof options . read === 'function' ) { this . _read = options . read ; } if ( typeof options . write === 'function' ) { this . _write = options . write ; } if ( typeof options . flush === 'function' ) { this . _flush = options . flush ; } } Duplex . call ( this , options ) ; // Register listeners for finish (v0.10) and prefinish (v0.12) to run _duplexPrefinish this . _duplexFinished = false ; this . once ( 'finish' , this . _duplexPrefinish . bind ( this ) ) ; this . once ( 'prefinish' , this . _duplexPrefinish . bind ( this ) ) ; // note: exclamation marks are used to convert to booleans if ( options && ! options . objectMode && ( ! options . readableObjectMode ) !== ( ! options . writableObjectMode ) ) { this . _writableState . objectMode = ! ! options . writableObjectMode ; this . _readableState . objectMode = ! ! options . readableObjectMode ; } if ( options && options . readableObjectMode ) { this . _readableState . highWaterMark = 16 ; } if ( options && options . writableObjectMode ) { this . _writableState . highWaterMark = 16 ; } streamMixins . call ( this , Duplex . prototype , options ) ; readableMixins . call ( this , options ) ; writableMixins . call ( this , options ) ; }
ZDuplex implements the Duplex stream interface.
ZDuplex also allows for a `_flush` function to facilitate cleanup.

@class ZDuplex
@constructor
@extends Duplex
@uses _Stream
@uses _Readable
@uses _Writable
@param {Object} [options] - Stream options
ZDuplex implements the Duplex stream interface . ZDuplex also allows for a _flush function to facilitate cleanup .