etOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode'),
  writableBuffer:
    ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableBuffer'),
  writableLength:
    ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableLength'),
  writableFinished:
    ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableFinished'),
  writableCorked:
    ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableCorked'),
  writableEnded:
    ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableEnded'),
  writableNeedDrain:
    ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableNeedDrain'),

  destroyed: {
    get() {
      if (this._readableState === undefined ||
        this._writableState === undefined) {
        return false;
      }
      return this._readableState.destroyed && this._writableState.destroyed;
    },
    set(value) {
      // Backward compatibility, the user is explicitly
      // managing destroyed.
      if (this._readableState && this._writableState) {
        this._readableState.destroyed = value;
        this._writableState.destroyed = value;
      }
    }
  }
});

let duplexify;

Duplex.from = function(body) {
  if (!duplexify) {
    duplexify = require('internal/streams/duplexify');
  }
  return duplexify(body, 'body');
};
