In my application I have a class manipulating with zip archive using System.IO.Compression.ZipArchive
.
Now I want to save the entries of the archive to file. How can I do that? I know I can associate a Stream
with archive but in my case the archive creates w/o streams and I can't change the code:
var archive = ZipFile.Open(fileName, ZipArchiveMode.Create);
// add entries
// how can I save it to file now?
You are already 'saving it to a file', the one indicated by fileName
.
To make sure everything is written and flushed, use a using
:
using (var archive = ZipFile.Open(fileName, ZipArchiveMode.Create))
{
// add entries
....
} // here it is saved and closed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With