code: function RawEncoder(schema, opts) {
    opts = opts || {};
  
    stream.Transform.call(this, {
      writableObjectMode: true,
      allowHalfOpen: false
    });
  
    this._type = types.Type.forSchema(schema);
    this._writeValue = function (tap, val) {
      try {
        this._type._write(tap, val);
      } catch (err) {
        this.emit('error', err);
      }
    };
    this._tap = new Tap(utils.newBuffer(opts.batchSize || 65536));
  }
docs: Duplex stream for encoding.