aboutsummaryrefslogtreecommitdiff
path: root/quikr_util.py
diff options
context:
space:
mode:
authorCalvin <calvin@EESI>2013-03-07 10:05:37 -0500
committerCalvin <calvin@EESI>2013-03-07 10:05:37 -0500
commit0240e880ce0f7b68553021d8a85dc1d092a8a5f9 (patch)
tree07d7a2aa837a46a1f509449918b0549ff5387ef0 /quikr_util.py
parentf1f0df1e32e1892fa07ae616bc76ac215d3c5dec (diff)
Check if file is compressed
Diffstat (limited to 'quikr_util.py')
-rw-r--r--quikr_util.py15
1 files changed, 15 insertions, 0 deletions
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
+
+