Created
June 5, 2019 00:57
-
-
Save ctkirkman/63cdba7001141aca1f70531ab1f8bd13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import magic | |
def read_magic(contentBytes): | |
magicType = None | |
try: | |
with magic.Magic() as m: | |
magicType = m.from_buffer(contentBytes) | |
except Exception as e: | |
print("libmagic") | |
print(str(e)) | |
finally: | |
return magicType |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment