<div dir="ltr"><div><div><div><div><div>Not sure about, if there's an equivalent function, but the difference with Gzip and Deflate is the following.<br></div>Gzip contains an information about the original file + deflate (compressed) stream of data.<br></div>Default is just stream of data.<br></div>For example ZIP files are using Deflate, but not using Gzip headers (providing their owns).<br><br></div><div>The difference is mentioned in deflateInit2() functions, where a user can specify windowBits. If the value is negative, to Gzip header would be generated.<br><br></div><div>I presume the gzcompress is passing negative value to the function, while gzencode passes a positive value to the function.<br></div><div><br></div>thanks,<br></div>Dmitry<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 7, 2015 at 11:26 AM, Graeme Geldenhuys <span dir="ltr"><<a href="mailto:mailinglists@geldenhuys.co.uk" target="_blank">mailinglists@geldenhuys.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I need to compress a file the same way as PHP's gzcompress() function:<br>
<br>
<a href="http://php.net/manual/en/function.gzcompress.php" rel="noreferrer" target="_blank">http://php.net/manual/en/function.gzcompress.php</a><br>
<br>
>From that URL it uses ZLIB, and that is apparently different to GZIP and<br>
DEFLATE, because PHP also has a gzencode() and gzdeflate() functions<br>
respectively.<br>
<br>
It seems the key point, from want I understand in the URL text, is that<br>
ZLIB compresses the data and has no Header Information, where GZIP does<br>
similar, but has Header Information.<br>
<br>
I'm still unclear as to the the differences between ZLIB and DEFLATE - I<br>
always assumed them to be the same thing.<br>
<br>
Anyway, so what is the equivalent to gzcompress in FPC? I see in the FCL<br>
there is a zlib.pp unit, but in the code comments in takes about<br>
wrapping the compressed data with gzip. So I'm not sure if this is then<br>
equivalent to PHP's gzcompress().<br>
<br>
Regards,<br>
- Graeme -<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal<br>
<a href="http://fpgui.sourceforge.net/" rel="noreferrer" target="_blank">http://fpgui.sourceforge.net/</a><br>
<br>
My public PGP key: <a href="http://tinyurl.com/graeme-pgp" rel="noreferrer" target="_blank">http://tinyurl.com/graeme-pgp</a><br>
_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal" rel="noreferrer" target="_blank">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a><br>
</font></span></blockquote></div><br></div>