lib/parser.js
function concatBulkBuffer (parser) {
  const list = parser.bufferCache
  const oldOffset = parser.offset
  const length = parser.bigStrSize - oldOffset - 2
  var chunks = list.length
  var offset = parser.bigStrSize - parser.totalChunkSize
  parser.offset = offset
  if (offset <= 2) {
    if (chunks === 2) {
      return list[0].slice(oldOffset, list[0].length + offset - 2)
    }
    chunks--
    offset = list[list.length - 2].length + offset
  }
  resizeBuffer(length)
  const start = bufferOffset
  list[0].copy(bufferPool, start, oldOffset, list[0].length)
  bufferOffset += list[0].length - oldOffset
  for (var i = 1; i < chunks - 1; i++) {
    list[i].copy(bufferPool, bufferOffset)
    bufferOffset += list[i].length
  }
  list[i].copy(bufferPool, bufferOffset, 0, offset - 2)
  bufferOffset += offset - 2
  return bufferPool.slice(start, bufferOffset)
}
function concatBulkBuffer (parser) {
  const list = parser.bufferCache
  const oldOffset = parser.offset
  const length = parser.bigStrSize - oldOffset - 2
  var chunks = list.length
  var offset = parser.bigStrSize - parser.totalChunkSize
  parser.offset = offset
  if (offset <= 2) {
    if (chunks === 2) {
      return list[0].slice(oldOffset, list[0].length + offset - 2)
    }
    chunks--
    offset = list[list.length - 2].length + offset
  }
  resizeBuffer(length)
  const start = bufferOffset
  list[0].copy(bufferPool, start, oldOffset, list[0].length)
  bufferOffset += list[0].length - oldOffset
  for (var i = 1; i < chunks - 1; i++) {
    list[i].copy(bufferPool, bufferOffset)
    bufferOffset += list[i].length
  }
  list[i].copy(bufferPool, bufferOffset, 0, offset - 2)
  bufferOffset += offset - 2
  return bufferPool.slice(start, bufferOffset)
}
function concatBulkBuffer ( parser ) { const list = parser . bufferCache const oldOffset = parser . offset const length = parser . bigStrSize - oldOffset - 2 var chunks = list . length var offset = parser . bigStrSize - parser . totalChunkSize parser . offset = offset if ( offset <= 2 ) { if ( chunks === 2 ) { return list [ 0 ] . slice ( oldOffset , list [ 0 ] . length + offset - 2 ) } chunks -- offset = list [ list . length - 2 ] . length + offset } resizeBuffer ( length ) const start = bufferOffset list [ 0 ] . copy ( bufferPool , start , oldOffset , list [ 0 ] . length ) bufferOffset += list [ 0 ] . length - oldOffset for ( var i = 1 ; i < chunks - 1 ; i ++ ) { list [ i ] . copy ( bufferPool , bufferOffset ) bufferOffset += list [ i ] . length } list [ i ] . copy ( bufferPool , bufferOffset , 0 , offset - 2 ) bufferOffset += offset - 2 return bufferPool . slice ( start , bufferOffset ) }
Concat the collected chunks from parser.bufferCache.

Increases the bufferPool size beforehand if necessary.

@param {JavascriptRedisParser} parser
@returns {Buffer}
Concat the collected chunks from parser . bufferCache .