flask.send_file(path_or_file, mimetype=None, as_attachment=False, download_name=None, attachment_filename=None, conditional=True, etag=True, add_etags=None, last_modified=None, max_age=None, cache_timeout=None)  
Send the contents of a file to the client. The first argument can be a file path or a file-like object. Paths are preferred in most cases because Werkzeug can manage the file and get extra information from the path. Passing a file-like object requires that the file is opened in binary mode, and is mostly useful when building a file in memory with io.BytesIO. Never pass file paths provided by a user. The path is assumed to be trusted, so a user could craft a path to access a file you didn’t intend. Use send_from_directory() to safely serve user-requested paths from within a directory. If the WSGI server sets a file_wrapper in environ, it is used, otherwise Werkzeug’s built-in wrapper is used. Alternatively, if the HTTP server supports X-Sendfile, configuring Flask with USE_X_SENDFILE = True will tell the server to send the given path, which is much more efficient than reading it in Python.  Parameters 
 
path_or_file – The path to the file to send, relative to the current working directory if a relative path is given. Alternatively, a file-like object opened in binary mode. Make sure the file pointer is seeked to the start of the data. 
mimetype – The MIME type to send for the file. If not provided, it will try to detect it from the file name. 
as_attachment – Indicate to a browser that it should offer to save the file instead of displaying it. 
download_name – The default name browsers will use when saving the file. Defaults to the passed file name. 
conditional – Enable conditional and range responses based on request headers. Requires passing a file path and environ. 
etag – Calculate an ETag for the file, which requires passing a file path. Can also be a string to use instead. 
last_modified – The last modified time to send for the file, in seconds. If not provided, it will try to detect it from the file path. 
max_age – How long the client should cache the file, in seconds. If set, Cache-Control will be public, otherwise it will be no-cache to prefer conditional caching.     Changed in version 2.0: download_name replaces the attachment_filename parameter. If as_attachment=False, it is passed with Content-Disposition: inline instead.   Changed in version 2.0: max_age replaces the cache_timeout parameter. conditional is enabled and max_age is not set by default.   Changed in version 2.0: etag replaces the add_etags parameter. It can be a string to use instead of generating one.   Changed in version 2.0: Passing a file-like object that inherits from TextIOBase will raise a ValueError rather than sending an empty file.   New in version 2.0: Moved the implementation to Werkzeug. This is now a wrapper to pass some Flask-specific arguments.   Changelog Changed in version 1.1: filename may be a PathLike object.   Changed in version 1.1: Passing a BytesIO object supports range requests.   Changed in version 1.0.3: Filenames are encoded with ASCII instead of Latin-1 for broader compatibility with WSGI servers.   Changed in version 1.0: UTF-8 filenames as specified in RFC 2231 are supported.   Changed in version 0.12: The filename is no longer automatically inferred from file objects. If you want to use automatic MIME and etag support, pass a filename via filename_or_fp or attachment_filename.   Changed in version 0.12: attachment_filename is preferred over filename for MIME detection.   Changed in version 0.9: cache_timeout defaults to Flask.get_send_file_max_age().   Changed in version 0.7: MIME guessing and etag support for file-like objects was deprecated because it was unreliable. Pass a filename if you are able to, otherwise attach an etag yourself.   Changed in version 0.5: The add_etags, cache_timeout and conditional parameters were added. The default behavior is to add etags.   New in version 0.2.