-
-
Notifications
You must be signed in to change notification settings - Fork 4
PKZip.ZipReader.MoveToPath
Andrew Lambert edited this page Nov 26, 2022
·
3 revisions
Function MoveToPath(PathName As String, Index As Integer = 0) As Boolean| Name | Type | Comment |
|---|---|---|
| PathName | String | The archive path of the entry to seek to. |
| Index | Integer | Optional. If the archive contains more than one entry with the same PathName then this parameter indicates which one you're referring to. |
Returns True if the PathName was found.
Finds the PathName in the archive and positions the reader to extract it. If the archive contains more than one item that matches the PathName then you may use the Index parameter to access them all.
If the PathName was not found then the reader's position is returned to where it started.
This example extracts a specific file from an archive and writes it to the user's desktop:
Dim zipfile As FolderItem = GetOpenFolderItem("") ' the zip archive to read
Dim zip As New PKZip.ZipReader(zipfile)
If zip.MoveToPath("path/to/the/file.txt") Then
' we found the file. Extract it into the output stream
Dim outputfile As FolderItem = SpecialFolder.Desktop.Child("file.txt")
Dim output As BinaryStream = BinaryStream.Create(outputfile)
Call zip.MoveNext(output)
output.Close
End If
zip.CloseWiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2014-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.