(filename: str)
return mimetypes.guess_type(fn)[0] or 'application/octet-stream'
Guesses the mimetype of a file based on the given ``filename``.
	
	.. code-block:: python
	
		>>> guess_mimetype('example.txt')
		'text/plain'
		>>> guess_mimetype('/foo/bar/example')
		'application/octet-stream'
	
	Parameters
	----------
	filename
		The file name or path for which the mimetype is to be guessed
Guesses the mimetype of a file based on the given ``filename``.
	
	.. code-block:: python
	
		>>> guess_mimetype('example.txt')
		'text/plain'
		>>> guess_mimetype('/foo/bar/example')
		'application/octet-stream'
	
	Parameters
	----------
	filename
		The file name or path for which the mimetype is to be guessed
Guesses the mimetype of a file based on the given filename . .. code - block :: python >>> guess_mimetype ( example . txt ) text / plain >>> guess_mimetype ( / foo / bar / example ) application / octet - stream Parameters ---------- filename The file name or path for which the mimetype is to be guessed
def guess_mimetype(filename: str) -> str:
	"""Guesses the mimetype of a file based on the given ``filename``.
	
	.. code-block:: python
	
		>>> guess_mimetype('example.txt')
		'text/plain'
		>>> guess_mimetype('/foo/bar/example')
		'application/octet-stream'
	
	Parameters
	----------
	filename
		The file name or path for which the mimetype is to be guessed
	"""
	fn = os.path.basename(filename)
	return mimetypes.guess_type(fn)[0] or 'application/octet-stream'
def guess_mimetype ( filename : str ) -> str : fn = os . path . basename ( filename ) return mimetypes . guess_type ( fn ) [ 0 ] or 'application/octet-stream'