send_file
Send the contents of a file to the client.
def send_file(
path_or_file: os.PathLike[t.AnyStr] | str | t.IO[bytes],
mimetype: str | None = None,
as_attachment: bool = False,
download_name: str | None = None,
conditional: bool = True,
etag: bool | str = True,
last_modified: datetime | int | float | None = None,
max_age: None | (int | t.Callable[[str | None], int | None]) = None
) - > Response
Send the contents of a file to the client.
Parameters
| Name | Type | Description |
|---|---|---|
| path_or_file | `os.PathLike[t.AnyStr] | str |
| mimetype | `str | None` = None |
| as_attachment | bool = False | Indicate to a browser that it should offer to save the file instead of displaying it. |
| download_name | `str | None` = None |
| conditional | bool = True | Enable conditional and range responses based on request headers. Requires passing a file path and environ. |
| etag | `bool | str` = True |
| last_modified | `datetime | int |
| max_age | `None | (int |
Returns
| Type | Description |
|---|---|
Response | A response object containing the file data and appropriate HTTP headers for delivery. |