File: example.py

package info (click to toggle)
file 5.04-5%2Bsqueeze5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,892 kB
  • ctags: 1,197
  • sloc: ansic: 10,909; sh: 9,192; makefile: 383; 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()