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)
| 1683 | return b"".join(data) |
| 1684 | |
| 1685 | async def read(self, size: int = -1) -> bytes: |
| 1686 | """Read at most `size` bytes from the file (less if there |
| 1687 | isn't enough data). |
| 1688 | |
| 1689 | The bytes are returned as an instance of :class:`bytes` |
| 1690 | If `size` is negative or omitted all data is read. |
| 1691 | |
| 1692 | :param size: the number of bytes to read |
| 1693 | |
| 1694 | .. versionchanged:: 3.8 |
| 1695 | This method now only checks for extra chunks after reading the |
| 1696 | entire file. Previously, this method would check for extra chunks |
| 1697 | on every call. |
| 1698 | """ |
| 1699 | return await self._read_size_or_line(size=size) |
| 1700 | |
| 1701 | def tell(self) -> int: |
| 1702 | """Return the current position of this file.""" |