Writing to a zip file C# with Example



Writing to a zip file C# with Example

To write a new .zip file: 
System.IO.Compression 
System.IO.Compression.FileSystem 
using (FileStream zipToOpen = new FileStream(@"C:\temp", FileMode.Open)) 
{ 
using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Update)) 
{ 
ZipArchiveEntry readmeEntry = archive.CreateEntry("Readme.txt"); 
using (StreamWriter writer = new StreamWriter(readmeEntry.Open())) 
{ 
writer.WriteLine("Information about this package."); 
writer.WriteLine("========================"); 
} 
} 
} 

0 Comment's

Comment Form