मैं एक तरीका है जिसके लगातार कोई प्रयोक्ता के रूप में एक ज़िप फ़ाइल धाराओं बनाने के लिए कोशिश कर रहा हूँ स्ट्रीमिंग शुरू MVC.NET यहस्ट्रीम ज़िप फ़ाइल
मैं करने के लिए एक Thread.Sleep जोड़ा (ताकि कोई व्यर्थ स्ट्रीमिंग का है) अनुकरण विलंबता
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();
}
यह जिप की तरह लगता है स्ट्रीमिंग शुरू नहीं होगा जब तक सभी फाइलों फ़ाइलें ज़िप कर रहे हैं कर रहे हैं। लगातार स्ट्रीम करने का कोई तरीका है? शायद एक अलग पुस्तकालय के साथ?
धन्यवाद, यह किया। – maxfridbe