code: def compute_url_info(
      path: epath.PathLike,
      checksum_cls=hashlib.sha256,
  ) -> UrlInfo:
      """Locally compute size, checksums of the given file."""
      path = epath.Path(path)
  
      checksum = checksum_cls()
      size = 0
      with path.open("rb") as f:
          while True:
              block = f.read(io.DEFAULT_BUFFER_SIZE)
              size += len(block)
              if not block:
                  break
              checksum.update(block)
  
      return UrlInfo(
          checksum=checksum.hexdigest(),  # base64 digest would have been better.
          size=utils.Size(size),
          filename=path.name,
      )
  
file_path: datasets/tensorflow_datasets/core/download/checksums.py
imports: import dataclasses
  import hashlib
  import io
  from typing import Any, Dict, Iterable, Optional
  from absl import logging
  from etils import epath
  from tensorflow_datasets.core import utils
label_desc: Use image node_id 1 for calling a global function with example usage: compute_url_info(path, checksum_cls) and returns: UrlInfo