Read at most `size` bytes from the file (less if there isn't enough data). The bytes are returned as an instance of :class:`bytes` If `size` is negative or omitted all data is read. :param size: the number of bytes to read .. versionchanged:: 3.8
(self, size: int = -1)
| 1671 | return b"".join(data) |
| 1672 | |
| 1673 | def read(self, size: int = -1) -> bytes: |
| 1674 | """Read at most `size` bytes from the file (less if there |
| 1675 | isn't enough data). |
| 1676 | |
| 1677 | The bytes are returned as an instance of :class:`bytes` |
| 1678 | If `size` is negative or omitted all data is read. |
| 1679 | |
| 1680 | :param size: the number of bytes to read |
| 1681 | |
| 1682 | .. versionchanged:: 3.8 |
| 1683 | This method now only checks for extra chunks after reading the |
| 1684 | entire file. Previously, this method would check for extra chunks |
| 1685 | on every call. |
| 1686 | """ |
| 1687 | return self._read_size_or_line(size=size) |
| 1688 | |
| 1689 | def tell(self) -> int: |
| 1690 | """Return the current position of this file.""" |