minix/external/bsd/file/dist/python/example.py

17 lines
226 B
Python
Raw Normal View History

2012-03-31 20:24:03 +02:00
import magic
ms = magic.open(magic.MAGIC_NONE)
ms.load()
type = ms.file("/path/to/some/file")
print type
f = file("/path/to/some/file", "r")
buffer = f.read(4096)
f.close()
type = ms.buffer(buffer)
print type
ms.close()