Defity

Speedy Python library to determine MIME type of file.

Install

$ pip install defity

Usage

>>> import defity
>>> defity.from_file('path/to/landscape.png')
'image/png'
>>> with open('path/to/landscape.png', 'rb') as f:
...     defity.from_file(f)
...
'image/png'

>>> defity.from_bytes(b'some-binary-content')
'image/png'