I am trying to add a file to an existing zip file using SharpZipLib. Preferably without creating any temporary files as the zip is large (about 2GB). And when using a temp file, the NTFS rights to the zip are changed. Not a good idea.
I tried the method supplied in the answer here sharpziplib - can you add a file without it copying the entire zip first? like so:
Public Function AddManifestToZip(ByVal zipfilePath As String, ByVal manifestFilePath As String) As Boolean
Dim zipArchive As SharpZip.ZipFile = New SharpZip.ZipFile(zipfilePath)
If File.Exists(manifestFilePath) Then
Dim diskarchivestorage = New DiskArchiveStorage(zipArchive, FileUpdateMode.Direct)
zipArchive.BeginUpdate(diskarchivestorage)
zipArchive.Add(manifestFilePath)
zipArchive.CommitUpdate()
zipArchive.Close()
Return True
End If
Return False
End Function
However I get the following error from the .CommitUpdate(): "Stream does not support writing"
Anyone got any clues how to circumvent this?