src/main/data/TwoBit.js
function parseSequenceRecord(buffer: ArrayBuffer, fileOffset: number): SequenceRecord {
  var jb = new jBinary(buffer, twoBitTypes.TYPE_SET);
  var header = jb.read('SequenceRecord');

  var dnaOffset = jb.tell() + 8 * header.maskBlockCount + 4;

  return {
    numBases: header.dnaSize,
    unknownBlockStarts: header.nBlockStarts,
    unknownBlockLengths: header.nBlockSizes,
    numMaskBlocks: header.maskBlockCount,
    maskBlockStarts: [],
    maskBlockLengths: [],
    dnaOffsetFromHeader: dnaOffset,
    offset: fileOffset
  };
}
function parseSequenceRecord(buffer: ArrayBuffer, fileOffset: number): SequenceRecord {
  var jb = new jBinary(buffer, twoBitTypes.TYPE_SET);
  var header = jb.read('SequenceRecord');

  var dnaOffset = jb.tell() + 8 * header.maskBlockCount + 4;

  return {
    numBases: header.dnaSize,
    unknownBlockStarts: header.nBlockStarts,
    unknownBlockLengths: header.nBlockSizes,
    numMaskBlocks: header.maskBlockCount,
    maskBlockStarts: [],
    maskBlockLengths: [],
    dnaOffsetFromHeader: dnaOffset,
    offset: fileOffset
  };
}
Parses a single SequenceRecord from the start of the ArrayBuffer.
fileOffset is the position of this sequence within the 2bit file.