function readCentralDirectory(reader, locator) {
  const { centralDirectoryOffset, centralDirectoryRecords } = locator;
  reader.seek(centralDirectoryOffset);

  const entries = [];
  while (reader.expect(signature.CENTRAL_FILE_HEADER)) {
    const entry = readCentralFileHeader(reader);
    entries.push(entry);
  }

  if (centralDirectoryRecords !== entries.length) {
    // We expected some records but couldn't find ANY.
    // This is really suspicious, as if something went wrong.
    throw Error(
      `Corrupted zip or bug: expected ${centralDirectoryRecords} records in central dir, got ${entries.length}`,
    );
  }

  return entries;
}
@param {BufferReader} reader
@param {CentralDirectoryLocator} locator
@returns {Array<CentralFileRecord>}