private void compareFiles(Path path1, Path path2, PlanetilerConfig config) {
    long size = FileUtils.fileSize(path1);
    if (compareArchive("archive size", size, FileUtils.fileSize(path2))) {
      AtomicLong bytesRead = new AtomicLong(0);
      var worker = new Worker("compare", Stats.inMemory(), 1, () -> {
        byte[] bytes1 = new byte[8192];
        byte[] bytes2 = new byte[8192];
        long n = 0;
        try (
          var is1 = Files.newInputStream(path1, StandardOpenOption.READ);
          var is2 = Files.newInputStream(path2, StandardOpenOption.READ)
        ) {
          do {
            int len = is1.read(bytes1);
            int len2 = is2.read(bytes2, 0, len);
            if (len2 != len) {
              String message = "Expected to read %s bytes from %s but got %s".formatted(len, path2, len2);
              archiveDiffs.add(message);
              LOGGER.warn(message);
              return;
            }
            int mismatch = Arrays.mismatch(bytes1, bytes2);
            if (mismatch >= 0 && mismatch < len) {
              archiveDiffs.add("mismatch at byte %s".formatted(mismatch + n));
              LOGGER.warn("Archives mismatch ay byte {}", mismatch + n);
              return;
            }
            n += len;
            bytesRead.set(n);
          } while (n < size);
        }
        LOGGER.info("No mismatches! Analyzed {} / {} bytes", n, size);
      });

      var logger = ProgressLoggers.create()
        .addStorageRatePercentCounter("bytes", size, bytesRead::get, true)
        .newLine()
        .addThreadPoolStats("compare", worker)
        .newLine()
        .addProcessStats();

      worker.awaitAndLog(logger, config.logInterval());
    }
  }
@throws FatalComparisonFailure if a comparison failure is encountered that prevents comparing the whole archives.
planetiler-core/src/main/java/com/onthegomap/planetiler/util/CompareArchives.java