我喜欢做的不是将 zip 文件存储在磁盘上,而是喜欢从 MemoryStream 中打开它。
我正在查看 DotNetZip 编程示例的文档:请注意,我根据我认为可能需要的内容对其进行了微调。
var ms = new MemoryStream();
using (ZipFile zip = new ZipFile())
{
zip.AddFile("ReadMe.txt");
zip.AddFile("7440-N49th.png");
zip.AddFile("2008_Annual_Report.pdf");
zip.Save(ms); // this will save the files in memory steam
}
// now what I need is for the zip file to open up so that
the user can view all the files in it. Not sure what to do next after
zip.Save(ms) for this to happen.