B4X Requires Chilkat v11.0.0+
B4X
Unzip Text File to String
See more Zip Examples
Demonstrates how to open a .zip and extract the 1st file (assuming it's a text file) to a string variable.Chilkat B4X Downloads
Dim success As Boolean = False
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim zip As ChilkatZip
zip.Initialize("zip")
success = zip.OpenZip("qa_data/zips/EC16100.zip")
If success = False Then
Log(zip.LastErrorText)
Return
End If
' Get the 1st file in the .zip
Dim entry As ChilkatZipEntry
entry.Initialize("entry")
success = zip.EntryAt(0, entry)
If success = False Then
Log(zip.LastErrorText)
Return
End If
Dim fileContents As String = entry.UnzipToString(0, "utf-8")
Log(fileContents)