Skip to content

miniproto.media

Public media-transfer APIs for downloading, uploading, CDN decryption, and range caching.

The exports intentionally group high-level download and upload helpers with the typed results, source/destination aliases, and CDN integrity errors they use.

  • CdnError — Raised when a CDN response cannot be reuploaded, decrypted, or interpreted.
  • CdnIntegrityError — Raised when a CDN range lacks valid FileHash coverage or verification fails.
  • CdnRedirect — Validated information supplied by Telegram when a file moves to its CDN.
  • decrypt_cdn_chunk — Decrypt a CDN ciphertext range with the counter aligned to its file offset.
  • DEFAULT_DOWNLOAD_CONCURRENCY — Public attribute miniproto.media.download.DEFAULT_DOWNLOAD_CONCURRENCY.
  • DEFAULT_DOWNLOAD_IN_FLIGHT_BYTES — Public attribute miniproto.media.download.DEFAULT_DOWNLOAD_IN_FLIGHT_BYTES.
  • DEFAULT_DOWNLOAD_PART_SIZE — Public attribute miniproto.media.download.DEFAULT_DOWNLOAD_PART_SIZE.
  • DEFAULT_RANGE_CACHE_BYTES — Public attribute miniproto.media.download.DEFAULT_RANGE_CACHE_BYTES.
  • Destination — Public type alias miniproto.media.download.Destination.
  • DownloadRangeCache — Async LRU cache that deduplicates exact media-range requests and bounded prefetches.
  • MAX_DOWNLOAD_CHUNK_SIZE — Public attribute miniproto.media.download.MAX_DOWNLOAD_CHUNK_SIZE.
  • MediaDownloadError — Raised when a requested media range cannot be downloaded or materialized.
  • MediaDownloadResult — Completed materialized-download metadata and optional in-memory payload.
  • MediaIntegrityError — Raised when declared file hashes or download-range invariants are violated.
  • download_file — Download media into memory, a path, or a caller-owned binary stream.
  • download_location_from_media — Resolve a media model, raw Telegram object, file ID, or input location for download.
  • download_media — Resolve media and materialize it through :func:download_file.
  • iter_download — Stream an exact media range as ordered, bounded byte chunks.
  • iter_download_media — Resolve a supported media object and stream it through :func:iter_download.
  • media_from_raw — Normalize supported raw Telegram media shapes into a :class:Media record.
  • BIG_FILE_THRESHOLD — Public attribute miniproto.media.upload.BIG_FILE_THRESHOLD.
  • DEFAULT_CHUNK_SIZE — Public attribute miniproto.media.upload.DEFAULT_CHUNK_SIZE.
  • FileSource — Public type alias miniproto.media.upload.FileSource.
  • MediaUploadError — Raised only for unsatisfiable part-count configuration or BoolFalse replies.
  • MediaUploadResult — Completed upload metadata and the MTProto input-file reference to reuse.
  • ProgressCallback — Public type alias miniproto.media.upload.ProgressCallback.
  • upload_file — Upload a source as MTProto file parts and return its input-file handle.