Sample Header Ad - 728x90

Reading partially downloaded gzip with an offset

5 votes
2 answers
5613 views
Let's say that there is one huge **db.sql.gz** of size 100GB available https://example.com/db/backups/db.sql.gz and the server supports range requests . So instead of downloading the entire file, I downloaded **y** bytes(let's say 1024bytes) with an offset of **x** bytes(let's say 1000bytes) like the following. curl -r 1000-2024 https://example.com/db/backups/db.sql.gz With the above command I was able to download the partial content of the gzipped file, now my question is how can I read that partial content? I tried gunzip -c db.sql.gz | dd ibs=1024 skip=0 count=1 > o.sql but this gives an error >gzip: dbrange.sql.gz: not in gzip format The error is acceptable since I guess at the top of the file may be there are header blocks which describes encoding. ------- I noticed that if I'm downloading the file without an offset, I'm able to read the file using gunzip and piping. curl -r 0-2024 https://example.com/db/backups/db.sql.gz
Asked by bravokeyl (153 rep)
Mar 9, 2018, 09:41 AM
Last activity: Aug 9, 2021, 09:44 AM