[fpc-pascal] How to duplicate PHP's gzcompress() function in FPC?
Dmitry Boyarintsev
skalogryz.lists at gmail.com
Wed Oct 7 17:51:33 CEST 2015
Not sure about, if there's an equivalent function, but the difference with
Gzip and Deflate is the following.
Gzip contains an information about the original file + deflate (compressed)
stream of data.
Default is just stream of data.
For example ZIP files are using Deflate, but not using Gzip headers
(providing their owns).
The difference is mentioned in deflateInit2() functions, where a user can
specify windowBits. If the value is negative, to Gzip header would be
generated.
I presume the gzcompress is passing negative value to the function, while
gzencode passes a positive value to the function.
thanks,
Dmitry
On Wed, Oct 7, 2015 at 11:26 AM, Graeme Geldenhuys <
mailinglists at geldenhuys.co.uk> wrote:
> Hi,
>
> I need to compress a file the same way as PHP's gzcompress() function:
>
> http://php.net/manual/en/function.gzcompress.php
>
> From that URL it uses ZLIB, and that is apparently different to GZIP and
> DEFLATE, because PHP also has a gzencode() and gzdeflate() functions
> respectively.
>
> It seems the key point, from want I understand in the URL text, is that
> ZLIB compresses the data and has no Header Information, where GZIP does
> similar, but has Header Information.
>
> I'm still unclear as to the the differences between ZLIB and DEFLATE - I
> always assumed them to be the same thing.
>
> Anyway, so what is the equivalent to gzcompress in FPC? I see in the FCL
> there is a zlib.pp unit, but in the code comments in takes about
> wrapping the compressed data with gzip. So I'm not sure if this is then
> equivalent to PHP's gzcompress().
>
> Regards,
> - Graeme -
>
> --
> fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
> http://fpgui.sourceforge.net/
>
> My public PGP key: http://tinyurl.com/graeme-pgp
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20151007/9da9a52d/attachment.html>
More information about the fpc-pascal
mailing list