(Lianja) 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.
loZip = createobject("CkZip")
llSuccess = loZip.OpenZip("qa_data/zips/test.zip")
if (llSuccess = .F.) then
? loZip.LastErrorText
release loZip
return
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.
lnNumEntries = loZip.NumEntries
? "NumEntries = " + str(lnNumEntries)
i = 0
do while i < lnNumEntries
loEntry = loZip.GetEntryByIndex(i)
if (loEntry.IsDirectory = .F.) then
loFileData = loEntry.Inflate()
// Do whatever you wish with the file data...
endif
release loEntry
i = i + 1
enddo
loZip.CloseZip()
? "Finished."
release loZip
|