Sample code for 30+ languages & platforms
PureBasic

GZip Decompress File

See more Gzip Examples

Demonstrates how to uncompress a .gz compressed file to get the uncompressed original file.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkGzip.pb"

Procedure ChilkatExample()

    success.i = 0

    ; This example assumes the Chilkat API to have been previously unlocked.
    ; See Global Unlock Sample for sample code.

    gzip.i = CkGzip::ckCreate()
    If gzip.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success = CkGzip::ckUncompressFile(gzip,"qa_data/gzip/something.csv.gz","qa_output/something.csv")
    If success <> 1
        Debug CkGzip::ckLastErrorText(gzip)
        CkGzip::ckDispose(gzip)
        ProcedureReturn
    EndIf

    Debug "File successfully uncompressed and extracted from the Gzip compressed format."


    CkGzip::ckDispose(gzip)


    ProcedureReturn
EndProcedure