Download Media str | bytes | BytesIO | BufferedReader, filename: str | None = None, mimetype: str | None = None, disabled: bool = False, *, label: str = 'Download') Html

Show a download button for a url, bytes, or file-like object.


download_txt =
    data="Hello, world!".encode("utf-8"),

download_image =
    data=open("hello.png", "rb"),


  • data: The data to download. Can be a string (interpreted as a URL), bytes, or a file opened in binary mode.

  • filename: The name of the file to download. If not provided, the name will be guessed from the data.

  • mimetype: The mimetype of the file to download, for example, (e.g. “text/csv”, “image/png”). If not provided, the mimetype will be guessed from the filename.


An Html object for a download button.