![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java JavaScript Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Retrieve Metadata from a Gzip FileSee more Gzip ExamplesThis example demonstrates how to use the The method reads the Gzip header and extracts any available metadata, including the embedded filename, comment, and optional extra data. The extracted information is returned in a Because these fields are optional, the example checks for the existence of each JSON member using Note: This example requires Chilkat v11.5.0 or greater.
integer li_rc integer li_Success oleobject loo_Gzip oleobject loo_Json string ls_GzPath string ls_Filename string ls_Comment string ls_ExtraData li_Success = 0 // This example demonstrates how to retrieve metadata embedded in a Gzip file. loo_Gzip = create oleobject li_rc = loo_Gzip.ConnectToNewObject("Chilkat.Gzip") if li_rc < 0 then destroy loo_Gzip MessageBox("Error","Connecting to COM object failed") return end if loo_Json = create oleobject li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") // The Gzip file to examine: ls_GzPath = "example.txt.gz" // Get the metadata information: li_Success = loo_Gzip.GetGzipInfo(ls_GzPath,loo_Json) if li_Success = 0 then Write-Debug loo_Gzip.LastErrorText destroy loo_Gzip destroy loo_Json return end if // Output the JSON containing metadata: Write-Debug "Gzip metadata JSON:" Write-Debug loo_Json.Emit() // Access individual fields only if they exist: if loo_Json.HasMember("filename") = 1 then ls_Filename = loo_Json.StringOf("filename") Write-Debug "Filename: " + ls_Filename end if if loo_Json.HasMember("comment") = 1 then ls_Comment = loo_Json.StringOf("comment") Write-Debug "Comment: " + ls_Comment end if if loo_Json.HasMember("extraData") = 1 then ls_ExtraData = loo_Json.StringOf("extraData") Write-Debug "ExtraData (Base64): " + ls_ExtraData end if destroy loo_Gzip destroy loo_Json |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.