From 0240e880ce0f7b68553021d8a85dc1d092a8a5f9 Mon Sep 17 00:00:00 2001 From: Calvin Date: Thu, 7 Mar 2013 10:05:37 -0500 Subject: Check if file is compressed --- quikr_util.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 quikr_util.py diff --git a/quikr_util.py b/quikr_util.py new file mode 100644 index 0000000..d055b74 --- /dev/null +++ b/quikr_util.py @@ -0,0 +1,15 @@ +# Helper Functions + +# Check if file is gzip compressed +def isCompressed(filename): + f = open(filename, "rb") + + # The first two bytes of a tar file are always '1f 8b' + if f.read(2) == '\x1f\x8b': + f.close() + return True + else: + f.close() + return False + + -- cgit v1.2.3