Gzip + chunked: should wait for the whole file to be downloaded before unpacking?

I am sure of the answer, but I would like someone to confirm this.

It is not possible to unzip only part of the file when gzip is used in HTTP headers. I have to download the whole file before being able to unzip it to get the data.

Right?

For example, if I get the first 100 bytes with some code:

myfile.read(100) 

I cannot unzip it at this moment.

Thanks.

0
source share
2 answers

You can immediately start unpacking the gzip stream for any amount of data that you have. You can extract all the uncompressed bytes represented in the compressed data that you still have.

You should always unpack from the start. So what you cannot do is start unpacking in the middle of the gzip stream. If you want to access data in the middle, you need to unzip all the data to this point.

+3
source

Wrong. GZIP allows streaming. Perhaps you are mixing the format with the format of the ZIP archive.

+1
source

Source: https://habr.com/ru/post/1200533/


All Articles