I'm trying to create a method which continually streams a zip file as a user downloads it (so that there is no wasted streaming)
I added a thread.sleep to simulate latency
public override void ExecuteResult(ControllerContext context) {
    HttpResponseBase response = context.HttpContext.Response;
    response.Clear();
    response.ClearContent();
    response.ClearHeaders();
    response.Cookies.Clear();
    response.ContentType = ContentType;
    response.ContentEncoding = Encoding.Default;
    response.AddHeader("Content-Type", ContentType);
    context.HttpContext.Response.AddHeader("Content-Disposition", 
                            String.Format("attachment; filename={0}", 
                            this.DownloadName));
    int ind = 0;
    using (ZipOutputStream zipOStream = 
                new ZipOutputStream(context.HttpContext.Response.OutputStream))
    {
        foreach (var file in FilesToZip)
        {
            ZipEntry entry = new ZipEntry(FilesToZipNames[ind++]);
            zipOStream.PutNextEntry(entry);
            Thread.Sleep(1000);
            zipOStream.Write(file, 0, file.Length);
            zipOStream.Flush();
        }
        zipOStream.Finish();
    }    
    response.OutputStream.Flush();
}
It seems like the zip will not start streaming until all the files are files are zipped. Is there a way to stream continuously? Maybe with a different library?
 
     
     
    