DataFlex
DataFlex
Gzip a File
See more Gzip Examples
Demonstrates how to create a .gz (gzipped file).Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoGzip
String sEmbeddedExtractPath
String sTemp1
Move False To iSuccess
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatGzip)) To hoGzip
If (Not(IsComObjectCreated(hoGzip))) Begin
Send CreateComObject of hoGzip
End
// This will create a .gz such that when ungzipped by a tool such as 7-Zip,
// it will create "qa_data/hamlet.xml".
Get ComCompressFile Of hoGzip "qa_data/hamlet.xml" "qa_output/hamlet.xml.gz" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoGzip To sTemp1
Showln sTemp1
Procedure_Return
End
// Call CompressFile2 to explicitly specify the ungzip path
// For example, this will create a .gz such that when ungzipped by a tool such as 7-Zip,
// it will create "hamlet.xml".
Move "hamlet.xml" To sEmbeddedExtractPath
Get ComCompressFile2 Of hoGzip "qa_data/hamlet.xml" sEmbeddedExtractPath "qa_output/hamlet2.xml.gz" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoGzip To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Success."
End_Procedure