Skip to content

Instantly share code, notes, and snippets.

@ctkirkman
Created June 5, 2019 00:57
Show Gist options
  • Save ctkirkman/63cdba7001141aca1f70531ab1f8bd13 to your computer and use it in GitHub Desktop.
Save ctkirkman/63cdba7001141aca1f70531ab1f8bd13 to your computer and use it in GitHub Desktop.
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