code: function dumpToBuffer(val) {
    var buf = new Accumulator();
    // Build out the header
    buf.writeByte(0);
    buf.writeByte(1);
    // Reserve room for an int32 to hold our PDU length
    buf.writeByte(BSER_INT32);
    buf.writeInt(0, 4); // We'll come back and fill this in at the end
  
    dump_any(buf, val);
  
    // Compute PDU length
    var off = buf.writeOffset;
    var len = off - 7 /* the header length */;
    buf.writeOffset = 3; // The length value to fill in
    buf.writeInt(len, 4); // write the length in the space we reserved
    buf.writeOffset = off;
  
    return buf.buf.slice(0, off);
  }
docs: BSER encode value and return a buffer of the contents