Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Unzip Files to Byte ArrayDemonstrates how to unzip each file contained in a .zip to an in-memory byte array.
Use ChilkatAx-9.5.0-win32.pkg Procedure Test Handle hoZip Boolean iSuccess Integer iNumEntries Integer i Variant vEntry Handle hoEntry Variant hoFileData String sTemp1 Boolean bTemp1 // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatZip)) To hoZip If (Not(IsComObjectCreated(hoZip))) Begin Send CreateComObject of hoZip End Get ComOpenZip Of hoZip "qa_data/zips/test.zip" To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoZip To sTemp1 Showln sTemp1 Procedure_Return End // Iterate of each entry in the zip. // An entry can be a file or directory entry. For each file, unzip to a byte array. Get ComNumEntries Of hoZip To iNumEntries Showln "NumEntries = " iNumEntries Move 0 To i While (i < iNumEntries) Get ComGetEntryByIndex Of hoZip i To vEntry If (IsComObject(vEntry)) Begin Get Create (RefClass(cComChilkatZipEntry)) To hoEntry Set pvComObject Of hoEntry To vEntry End Get ComIsDirectory Of hoEntry To bTemp1 If (bTemp1 = False) Begin Get ComInflate Of hoEntry To hoFileData // Do whatever you wish with the file data... End Send Destroy of hoEntry Move (i + 1) To i Loop Send ComCloseZip To hoZip Showln "Finished." End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.