code: function encodeVarInt(value) {
      var bytes = [], cursor, length, i;
  
      do {
          bytes.push(value & 0x7F);
          value >>= 7;
      } while (value > 0);
  
      length = bytes.length;
      cursor = new BufferCursor(new buffer.Buffer(length));
  
      for (i = length - 1; i >= 0; i -= 1) {
          if (i > 0) {
              bytes[i] |= 0x80;
          }
  
          cursor.writeUInt8(bytes[i]);
      }
  
      return cursor.buffer;
  }
docs: Encode an integer as a variable-length integer
  (up to 4 bytes in big-endian order, if
  the MSB is set, it means another byte is following).
  
  @private
  @param {number} value Integer to encode
  @return {Buffer} Encoded variable-length integer