# pydicom.fileutil.find_bytes

pydicom.fileutil.find_bytes(fp: BinaryIO, bytes_to_find: bytes, read_size: int = 128, rewind: bool = True) → int | None

  Read in the file until a specific byte sequence found.

  Parameters:

    - fp (file-like) – The file-like to search.

    - bytes_to_find (bytes) – Contains the bytes to find. Must be in correct endian order already.

    - read_size (int) – Number of bytes to read at a time.

    - rewind (bool) – Flag to rewind file reading position.

  Returns:

    found_at – Position where byte sequence was found, else `None`.

  Return type:

    int or None