1
from subprocess import Popen, PIPE
4
"""Compresses a string with the xz binary"""
6
process = Popen(["xz", "--compress", "--force"], stdin=PIPE, stdout=PIPE)
7
return process.communicate(value)[0]
10
"""Decompresses a string with the xz binary"""
12
process = Popen(["xz", "--decompress", "--stdout", "--force"],
13
stdin=PIPE, stdout=PIPE)
14
return process.communicate(value)[0]
16
def compress_file(path):
17
"""Compress the file at 'path' with the xz binary"""
19
process = Popen(["xz", "--compress", "--force", "--stdout", path], stdout=PIPE)
20
return process.communicate()[0]