xref: /netbsd-src/external/bsd/file/dist/python/example.py (revision 5ccaa8c050356ff0b3e7eb93c53dc31cacd69336)
1*5ccaa8c0Schristos#! /usr/bin/python
2*5ccaa8c0Schristos
31b108b8bSchristosimport magic
41b108b8bSchristos
5*5ccaa8c0Schristosms = magic.open(magic.NONE)
61b108b8bSchristosms.load()
7*5ccaa8c0Schristostp = ms.file("/bin/ls")
8*5ccaa8c0Schristosprint (tp)
91b108b8bSchristos
10*5ccaa8c0Schristosf = open("/bin/ls", "rb")
11*5ccaa8c0Schristosbuf = f.read(4096)
121b108b8bSchristosf.close()
131b108b8bSchristos
14*5ccaa8c0Schristostp = ms.buffer(buf)
15*5ccaa8c0Schristosprint (tp)
161b108b8bSchristos
171b108b8bSchristosms.close()
18