vendor/GLTFExporter.js
function getPaddedArrayBuffer(arrayBuffer, paddingByte) {
      paddingByte = paddingByte || 0;

      var paddedLength = getPaddedBufferSize(arrayBuffer.byteLength);

      if (paddedLength !== arrayBuffer.byteLength) {
        var array = new Uint8Array(paddedLength);
        array.set(new Uint8Array(arrayBuffer));

        if (paddingByte !== 0) {
          for (var i = arrayBuffer.byteLength; i < paddedLength; i++) {
            array[i] = paddingByte;
          }
        }

        return array.buffer;
      }

      return arrayBuffer;
    }
function getPaddedArrayBuffer(arrayBuffer, paddingByte) {
      paddingByte = paddingByte || 0;

      var paddedLength = getPaddedBufferSize(arrayBuffer.byteLength);

      if (paddedLength !== arrayBuffer.byteLength) {
        var array = new Uint8Array(paddedLength);
        array.set(new Uint8Array(arrayBuffer));

        if (paddingByte !== 0) {
          for (var i = arrayBuffer.byteLength; i < paddedLength; i++) {
            array[i] = paddingByte;
          }
        }

        return array.buffer;
      }

      return arrayBuffer;
    }
function getPaddedArrayBuffer ( arrayBuffer , paddingByte ) { paddingByte = paddingByte || 0 ; var paddedLength = getPaddedBufferSize ( arrayBuffer . byteLength ) ; if ( paddedLength !== arrayBuffer . byteLength ) { var array = new Uint8Array ( paddedLength ) ; array . set ( new Uint8Array ( arrayBuffer ) ) ; if ( paddingByte !== 0 ) { for ( var i = arrayBuffer . byteLength ; i < paddedLength ; i ++ ) { array [ i ] = paddingByte ; } } return array . buffer ; } return arrayBuffer ; }
Returns a buffer aligned to 4-byte boundary.

@param {ArrayBuffer} arrayBuffer Buffer to pad
@param {Integer} paddingByte (Optional)
@returns {ArrayBuffer} The same buffer if it's already aligned to 4-byte boundary or a new buffer
Returns a buffer aligned to 4 - byte boundary .