fast_upload()

Client.fast_upload(file: str | BinaryIO | BytesIO, workers: int = 8, chunk_size: int = 1048576, progress: Callable | None = None, progress_args: tuple = ()) InputFile | InputFileBig

Upload a file or buffer at maximum speed using multi-part parallel chunk workers.

Parameters:
  • file (str | io.BytesIO | BinaryIO) – The path to the file to upload, or an in-memory binary stream.

  • workers (int, optional) – Number of concurrent parallel upload workers (1 to 16). Defaults to 8.

  • chunk_size (int, optional) – Size of each uploaded chunk in bytes. Defaults to 1 MB (1048576).

  • progress (Callable, optional) – Callback function with signature (current_bytes, total_bytes).

  • progress_args (tuple, optional) – Extra custom arguments for the progress callback.

Returns:

InputFile | InputFileBig – The uploaded MTProto input file object ready to be passed to send_video, send_document, etc.

Upload a file or buffer at maximum speed using multi-part parallel chunk workers.