import sys

import magic

filename = sys.argv[1]

print("from_file: {0}, mime: {1}".format(
    magic.from_file(filename),
    magic.from_file(filename, mime=True)),
)

content = open(filename, "rb").read()
print("from_buffer: {0}, mime: {1}".format(
    magic.from_buffer(content),
    magic.from_buffer(content, mime=True)),
)
