Specifies values for interacting with zip archive entries.
Assembly: System.IO.Compression (in System.IO.Compression.dll)
When you set the mode to , the underlying file or stream must support reading, but does not have to support seeking. If the underlying file or stream supports seeking, the files are read from the archive as they are requested. If the underlying file or stream does not support seeking, the entire archive is held in memory.
When you set the mode to , the underlying file or stream must support writing, but does not have to support seeking. Each entry in the archive can be opened only once for writing. If you create a single entry, the data is written to the underlying stream or file as soon as it is available. If you create multiple entries, such as by calling the CreateFromDirectory method, the data is written to the underlying stream or file after all the entries are created.
When you set the mode to , the underlying file or stream must support reading, writing, and seeking. The content of the entire archive is held in memory, and no data is written to the underlying file or stream until the archive is disposed.
The following methods include a parameter named mode that lets you specify the archive mode:
The following example shows how to specify a value when creating a ZipArchive object.
Imports System.IO Imports System.IO.Compression Module Module1 Sub Main() Using zipToOpen As FileStream = New FileStream("c:\users\exampleuser\release.zip", FileMode.Open) Using archive As ZipArchive = New ZipArchive(zipToOpen, ZipArchiveMode.Update) Dim readmeEntry As ZipArchiveEntry = archive.CreateEntry("Readme.txt") Using writer As StreamWriter = New StreamWriter(readmeEntry.Open()) writer.WriteLine("Information about this package.") writer.WriteLine("========================") End Using End Using End Using End Sub End Module