![]() |
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
(C#) Retrieve Metadata from Gzip Data in Memory (BinData)This example demonstrates how to use the The Gzip data is first loaded into the The metadata is returned in a Note: This example requires Chilkat v11.5.0 or greater.
bool success = false; // This example demonstrates how to retrieve metadata from Gzip data // stored in a BinData object. Chilkat.Gzip gzip = new Chilkat.Gzip(); Chilkat.BinData bd = new Chilkat.BinData(); Chilkat.JsonObject json = new Chilkat.JsonObject(); // Load a Gzip file into BinData: success = bd.LoadFile("example.txt.gz"); if (success == false) { Debug.WriteLine(bd.LastErrorText); return; } // Get the metadata information from the in-memory Gzip data: success = gzip.GetGzipInfoBd(bd,json); if (success == false) { Debug.WriteLine(gzip.LastErrorText); return; } // Output the JSON containing metadata: Debug.WriteLine("Gzip metadata JSON:"); Debug.WriteLine(json.Emit()); // Access individual fields only if they exist: if (json.HasMember("filename") == true) { string filename = json.StringOf("filename"); Debug.WriteLine("Filename: " + filename); } if (json.HasMember("comment") == true) { string comment = json.StringOf("comment"); Debug.WriteLine("Comment: " + comment); } if (json.HasMember("extraData") == true) { string extraData = json.StringOf("extraData"); Debug.WriteLine("ExtraData (Base64): " + extraData); } |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.