mirror of
https://github.com/kennethreitz-archive/django-mediasync.git
synced 2026-06-05 23:40:18 +00:00
9 lines
237 B
Python
9 lines
237 B
Python
|
|
def compress(data, level=6):
|
|
zbuf = cStringIO.StringIO()
|
|
zfile = gzip.GzipFile(mode='wb', compresslevel=level, fileobj=zbuf)
|
|
zfile.write(data)
|
|
zfile.close()
|
|
gzdata = zbuf.getvalue()
|
|
zbuf.close()
|
|
return gzdata |