libmagic
is a versatile library for identifying file types by analyzing their content, akin to the Unix file command. Compatible with Python versions 2.6, 2.7, and 3.2+, it operates seamlessly across Unix, Windows, and macOS systems. It's open for modification, redistribution, or any use, adhering to a public domain license. Ideal for validating uploaded files or classifying file types in diverse applications, libmagic offers a robust solution for file management challenges.
brew install libmagic
sudo apt-get install libmagic1
Install with the requirements.txt