File: example.py

package info (click to toggle)
file 4.17-5etch1
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 3,088 kB
  • ctags: 704
  • sloc: sh: 10,600; ansic: 6,341; makefile: 345; perl: 46; python: 24
file content (16 lines) | stat: -rw-r--r-- 226 bytes parent folder | download | duplicates (11)
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()