0

Is there any Python library for creating compressed files on-the-fly so I can start sending the file while it is compressing. Right now, I am doing this:

mydata=zlib.compress(open('files/SpeedTest_16MB.dat', 'rb').read(), zlib.Z_BEST_COMPRESSION)
result = requests.post("http://localhost/", data=mydata)
print result.status_code

This code sequence first compresses the file and then sends it. Is there any way to do this simultaneously and to transmit while compressing. I am concerned about the compression ratio also

0 Answers0