InputFile#

class aiogram.types.input_file.InputFile(filename: Optional[str] = None, chunk_size: int = 65536)[source]#

This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.

Source: https://core.telegram.org/bots/api#inputfile

abstract async read(chunk_size: int) AsyncGenerator[bytes, None][source]#
class aiogram.types.input_file.BufferedInputFile(file: bytes, filename: str, chunk_size: int = 65536)[source]#
classmethod from_file(path: Union[str, Path], filename: Optional[str] = None, chunk_size: int = 65536) BufferedInputFile[source]#

Create buffer from file

Parameters:
  • path – Path to file

  • filename – Filename to be propagated to telegram. By default, will be parsed from path

  • chunk_size – Uploading chunk size

Returns:

instance of BufferedInputFile

async read(chunk_size: int) AsyncGenerator[bytes, None][source]#
class aiogram.types.input_file.FSInputFile(path: Union[str, Path], filename: Optional[str] = None, chunk_size: int = 65536)[source]#
async read(chunk_size: int) AsyncGenerator[bytes, None][source]#
class aiogram.types.input_file.URLInputFile(url: str, filename: Optional[str] = None, chunk_size: int = 65536, timeout: int = 30)[source]#
async read(chunk_size: int) AsyncGenerator[bytes, None][source]#