From 02573f2d7154bbe159ba99728d5db9be8a29bd9b Mon Sep 17 00:00:00 2001 From: delphij Date: Tue, 24 Jun 2014 21:24:48 +0000 Subject: Vendor import of file 5.19. --- python/example.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 python/example.py (limited to 'python/example.py') diff --git a/python/example.py b/python/example.py new file mode 100644 index 0000000..0cd0b5e --- /dev/null +++ b/python/example.py @@ -0,0 +1,17 @@ +#! /usr/bin/python + +import magic + +ms = magic.open(magic.NONE) +ms.load() +tp = ms.file("/bin/ls") +print (tp) + +f = open("/bin/ls", "rb") +buf = f.read(4096) +f.close() + +tp = ms.buffer(buf) +print (tp) + +ms.close() -- cgit v1.1