[fpc-pascal] How to duplicate PHP's gzcompress() function in FPC?

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed Oct 7 17:26:06 CEST 2015


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



More information about the fpc-pascal mailing list