aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xfusearchive.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/fusearchive.py b/fusearchive.py
index 6680e3f..804991d 100755
--- a/fusearchive.py
+++ b/fusearchive.py
@@ -7,7 +7,8 @@
# See the file COPYING.
#
-import os, sys, shutil, fcntl, fuse, re, tempfile, sha, pickle
+import os, sys, shutil, fcntl, fuse, re
+import tempfile, sha, pickle, gzip
from errno import *
from stat import *
from fuse import Fuse
@@ -44,7 +45,7 @@ def inflate( src, dest ):
print "Unpickling: " + src
# TODO: return an IO error if inflating fails
- inp = open( src, "r" )
+ inp = gzip.open( src, "r" )
magic = pickle.load( inp )
inp.close()
print "Got data: " + str( magic )
@@ -70,7 +71,7 @@ def inflate( src, dest ):
if os.path.exists( "./storage/" + subpath ):
print "Exporting chunk"
- readchunk = open( "./storage/" + subpath )
+ readchunk = gzip.open( "./storage/" + subpath )
out.write( readchunk.read() )
readchunk.close()
else:
@@ -147,7 +148,7 @@ def deflate( src, dest ):
else:
# We found a spot, dump our data here
print "No block here, creating new block"
- savechunk = open( checkpath, "w" )
+ savechunk = gzip.open( checkpath, "w" )
savechunk.write( chunk )
savechunk.close
break
@@ -157,7 +158,7 @@ def deflate( src, dest ):
inp.close()
- out = open( dest, "w" )
+ out = gzip.open( dest, "w" )
pickle.dump( {
'stat': os.stat( src ),
'data': hashs
@@ -199,7 +200,7 @@ class FuseArchive(Fuse):
#pdb.set_trace()
# Override size
- inp = open( treefile )
+ inp = gzip.open( treefile )
magic = pickle.load( inp )
inp.close()