decodeRecords = async (codec, recordsDecoder, recordContext) => {
  if (!codec) {
    return recordsDecoder.readArray(decoder => decodeRecord(decoder, recordContext))
  }

  const length = recordsDecoder.readInt32()

  if (length <= 0) {
    return []
  }

  const compressedRecordsBuffer = recordsDecoder.readAll()
  const decompressedRecordBuffer = await codec.decompress(compressedRecordsBuffer)
  const decompressedRecordDecoder = new Decoder(decompressedRecordBuffer)
  const records = new Array(length)

  for (let i = 0; i < length; i++) {
    records[i] = decodeRecord(decompressedRecordDecoder, recordContext)
  }

  return records
}
v0
RecordBatch =>
 FirstOffset => int64
 Length => int32
 PartitionLeaderEpoch => int32
 Magic => int8
 CRC => int32
 Attributes => int16
 LastOffsetDelta => int32
 FirstTimestamp => int64
 MaxTimestamp => int64
 ProducerId => int64
 ProducerEpoch => int16
 FirstSequence => int32
 Records => [Record]