]> arthur.barton.de Git - bup.git/blobdiff - helpers.py
Rewrite bup-join in python and add remote server support.
[bup.git] / helpers.py
index 0cb4332968ac8659bb81ffb67b531c603d403613..e7e70bda9f5dabe525640847e967f842e5396733 100644 (file)
@@ -97,10 +97,16 @@ def linereader(f):
         yield line[:-1]
 
 
-def chunkyreader(f, count):
-    while count > 0:
-        b = f.read(min(count, 65536))
-        if not b:
-            raise IOError('EOF with %d bytes remaining' % count)
-        yield b
-        count -= len(b)
+def chunkyreader(f, count = None):
+    if count != None:
+        while count > 0:
+            b = f.read(min(count, 65536))
+            if not b:
+                raise IOError('EOF with %d bytes remaining' % count)
+            yield b
+            count -= len(b)
+    else:
+        while 1:
+            b = f.read(65536)
+            if not b: break
+            yield b