Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to ... unzip a ZIP file using the internal zlib API not vfs::zip?

468 views
Skip to first unread message

MartinLemburg@Siemens-PLM

unread,
Oct 19, 2015, 8:11:35 AM10/19/15
to
Hi,

If I understood it right, zlib unzips only zlib or gzip formats, but can it unzip the always found PK"ZIP" files?

And ... how to access the files in a ZIP file, because the zlib API "only" provides access to the data inside the archive, doesn't it?

I tried to find an example in the wiki, but failed.
Any example available?

Best regards,

Martin

Rich

unread,
Oct 19, 2015, 10:04:06 AM10/19/15
to
MartinLemburg@Siemens-PLM <martin.lembur...@gmx.net> wrote:
> Hi,

> If I understood it right, zlib unzips only zlib or gzip formats, but
> can it unzip the always found PK"ZIP" files?

zlib/gzip != pkzip

One is a stream compressor (zlib/gzip), the other is an archive format
(pkzip) which uses the same underlying stream compression.

> And ... how to access the files in a ZIP file, because the zlib API
> "only" provides access to the data inside the archive, doesn't it?

zlib only handles compressing/decompressing a blob of data. What you
do with it before/after is not part of zlib's area.

> I tried to find an example in the wiki, but failed.
> Any example available?

Try here:
http://wiki.tcl.tk/15158
http://wiki.tcl.tk/16208
Maybe they might shed some light on your question.

Mucha Albrecht

unread,
Oct 19, 2015, 10:22:26 AM10/19/15
to
Hi Martin,
the zlib library has functions for compressing and uncompressing data.

The zip-archive is a completely diffent thing. Content of a zip-archive
can optionally be compressed with one of the compression algorithms offered
by the zlib-library.

For reading or extracting of a zip-archive use the ::vfs::zip module.
This will useinternaly the zlib library fur uncompressin.

The manual page of the core zlib command in tcl 8.6 says:
The zlib command provides access to the compression and check-summing
facilities of the Zlib library by Jean-loup Gailly and Mark Adler. It has
the following subcommands.
--
Mit freundlichen Grüßen
Albrecht Mucha


MediTec GmbH Tel.:05063-959234 GF: Ortwin Bleich
Griesbergstr. 1b-c Fax: 05063-959261 HRB1522
31162 Bad Salzdetfurth Mail: a.m...@meditec-gmbh.com

MartinLemburg@Siemens-PLM

unread,
Oct 19, 2015, 11:51:07 AM10/19/15
to
Thanks Albrecht!

I had used vfs::zip in the past - with some problems and a bad performance.
Now, I seem to have figured out the reasons for the problems and the performance seems to be much better.

Best regards,

Martin

Andreas Kupries

unread,
Nov 4, 2015, 12:08:28 AM11/4/15
to
"MartinLemburg@Siemens-PLM" <martin.lembur...@gmx.net>
writes:

> Thanks Albrecht!
>
> I had used vfs::zip in the past - with some problems and a bad performance.
> Now, I seem to have figured out the reasons for the problems and the performance seems to be much better.

Also http://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/modules/zip/encode.html
and http://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/modules/zip/decode.html

--
So long,
Andreas Kupries <akup...@shaw.ca>
<http://core.tcl.tk/akupries/>
Developer @ Hewlett Packard Enterprise
-------------------------------------------------------------------------------

MartinLemburg@Siemens-PLM

unread,
Nov 4, 2015, 6:40:38 AM11/4/15
to
Thanks Andreas for pointing this out!
0 new messages