summaryrefslogtreecommitdiff
path: root/dist/file/python/example.py
blob: fc41a86d7ed7bad82bc85f5204dd88e502708892 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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()