Unzip file using DotNetZip not wokring on Mac

209 Views Asked by At

I am downloading a zipped folder using DotNetZip, file is downloading && its extracting on windows but when i am trying to Un zip that zip folder, it is not opening. On mac machine?

//Define file Type
string fileType = "application/octet-stream";

//Define Output Memory Stream
var outputStream = new MemoryStream();

//Create object of ZipFile library
using (ZipFile zipFile = new ZipFile())
{
    //Add Root Directory Name "Files" or Any string name
    zipFile.AddDirectoryByName("Files");

    //Get all filepath from folder
    String[] files = Directory.GetFiles(Server.MapPath("/BillingReport"));
    foreach (string file in files)
    {
        string filePath = file;

        //Adding files from filepath into Zip
        zipFile.AddFile(filePath, "Files");
    }

    Response.ClearContent();
    Response.ClearHeaders();

    //Set zip file name
    Response.AppendHeader("content-disposition", "attachment; filename=BillingReport.zip");

    //Save the zip content in output stream
    zipFile.Save(outputStream);
}

//Set the cursor to start position
outputStream.Position = 0;

Array.ForEach(Directory.GetFiles(Server.MapPath("/BillingReport")), System.IO.File.Delete);

//Dispance the stream
return new FileStreamResult(outputStream, fileType);
0

There are 0 best solutions below