【发布时间】:2018-10-17 16:29:12
【问题描述】:
我将如何基本上使用ZipFile.CreateFromDirectory 将 zipfile 发送回内存流而不是输出路径。
或者我必须使用ZipArchive 并自己生成 zip 文件吗?似乎有点奇怪,没有流的方法。
这基本上就是我想要做的事情
using (MemoryStream ms = new MemoryStream())
{
ZipFile.CreateFromDirectory(path, ms)
buf = ms.ToArray();
LogZipFile(path, filesize, buf.LongLength);
}
【问题讨论】:
-
您可以执行类似stackoverflow.com/questions/17232414/… 的操作,但自己进行迭代。