MCPcopy Index your code
hub / github.com/socketio/socket.io / concatChunks

Function concatChunks

client-dist/socket.io.js:506–523  ·  view source on GitHub ↗
(chunks, size)

Source from the content-addressed store, hash-verified

504 }, 0);
505 }
506 function concatChunks(chunks, size) {
507 if (chunks[0].length === size) {
508 return chunks.shift();
509 }
510 var buffer = new Uint8Array(size);
511 var j = 0;
512 for (var i = 0; i < size; i++) {
513 buffer[i] = chunks[0][j++];
514 if (j === chunks[0].length) {
515 chunks.shift();
516 j = 0;
517 }
518 }
519 if (chunks.length && j < chunks[0].length) {
520 chunks[0] = chunks[0].slice(j);
521 }
522 return buffer;
523 }
524 function createPacketDecoderStream(maxPayload, binaryType) {
525 if (!TEXT_DECODER) {
526 TEXT_DECODER = new TextDecoder();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected