| View previous topic :: View next topic |
| Author |
Message |
guided Guest
|
Posted: Fri Oct 03, 2008 10:55 pm Post subject: zlib fo reading in individual files from gzip |
|
|
Hi,
I apologize if this has been asked before but I personally couldn>t
find an answer to this question anywhere. Perhaps this reflects my
lack of understanding the zlib compression/decompression library.
I>ve currently got a .gz file with a number of MP3 files gzipped. I
simply need to unzip the main .gz file and then be able to read in
individual files from the gzip (and also be able to 'jump' to
particular files within the .gz file).
I would *extremely appreciate* if someone can point me to:
a) the right direction, and/or
b) provide me with an example (code)
I>m very new to zlib but understand that this must be easy to do yet
not extremely obvious by just going through existing examples and
docs.
Any help would, again, be extremely appreciated.
Thanks |
|
| |
|
Back to top |
Thomas Pornin Guest
|
Posted: Sat Oct 04, 2008 9:18 pm Post subject: Re: zlib fo reading in individual files from gzip |
|
|
According to guided <guidedways@googlemail.com>:
[quote]I>ve currently got a .gz file with a number of MP3 files gzipped. I
simply need to unzip the main .gz file and then be able to read in
individual files from the gzip (and also be able to 'jump' to
particular files within the .gz file).
[/quote]
gzip is not an archive format. Gzip compresses a single stream of bytes.
If several MP3 files were aggregated into a single gzip-compressed
archive, then this means that an archive format was used to group those
files into a single stream, which was then compressed with gzip. This is
a standard procedure in the Unix world, using "tar" or "cpio" for the
archiver part.
zlib will only help you for the gzip part, i.e. the uncompression of the
single big stream. Afterwards, you still have to split the uncompressed
stream into individual files, according to the archive format which was
actually used (and there are several possibilities; you will have to
find out that information). Zlib does not provide support for any
archive format.
--Thomas Pornin |
|
| |
|
Back to top |
Qubeley Guest
|
Posted: Mon Oct 06, 2008 8:25 am Post subject: Re: zlib fo reading in individual files from gzip |
|
|
On Oct 4, 6:55 am, guided <guidedw...@googlemail.com> wrote:
[quote]Hi,
I apologize if this has been asked before but I personally couldn>t
find an answer to this question anywhere. Perhaps this reflects my
lack of understanding the zlib compression/decompression library.
I>ve currently got a .gz file with a number of MP3 files gzipped. I
simply need to unzip the main .gz file and then be able to read in
individual files from the gzip (and also be able to 'jump' to
particular files within the .gz file).
I would *extremely appreciate* if someone can point me to:
a) the right direction, and/or
b) provide me with an example (code)
I>m very new to zlib but understand that this must be easy to do yet
not extremely obvious by just going through existing examples and
docs.
Any help would, again, be extremely appreciated.
Thanks
[/quote]
May be you can try to probe to the (optional) GZ extra header
containing the name of file to decompress and start decompressing
using ZLIB until reach the next extra header which implies another
file.. if there are no such headers/magic numbers in the original gz
file to mark boundaries compressed bits of files then extracting bits
on a per file base is not possible. |
|
| |
|
Back to top |
|