Tutorial by Examples

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...
The following example will return the byte[] data of a zipped file containing the files provided to it, without needing access to the file system. public static byte[] ZipFiles(Dictionary<string, byte[]> files) { using (MemoryStream ms = new MemoryStream()) { using (ZipArc...
This example gets a listing of files from the provided zip archive binary data: public static Dictionary<string, byte[]> GetFiles(byte[] zippedFile) { using (MemoryStream ms = new MemoryStream(zippedFile)) using (ZipArchive archive = new ZipArchive(ms, ZipArchiveMode.Read)) ...
using System; using System.IO; using System.IO.Compression; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string zipPath = @"c:\example\start.zip"; string extractPath = @"c:\example\extract...

Page 1 of 1