(AutoIt) Unzip Files to Byte Array
Demonstrates how to unzip each file contained in a .zip to an in-memory byte array.
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oZip = ObjCreate("Chilkat_9_5_0.Zip")
Local $bSuccess = $oZip.OpenZip("qa_data/zips/test.zip")
If ($bSuccess = False) Then
ConsoleWrite($oZip.LastErrorText & @CRLF)
Exit
EndIf
; Iterate of each entry in the zip.
; An entry can be a file or directory entry. For each file, unzip to a byte array.
Local $iNumEntries = $oZip.NumEntries
ConsoleWrite("NumEntries = " & $iNumEntries & @CRLF)
Local $i = 0
While $i < $iNumEntries
Local $oEntry = $oZip.GetEntryByIndex($i)
If ($oEntry.IsDirectory = False) Then
Local $oFileData = $oEntry.Inflate()
; Do whatever you wish with the file data...
EndIf
$i = $i + 1
Wend
$oZip.CloseZip
ConsoleWrite("Finished." & @CRLF)
|