DotNetZip:将Zip文件转换为字节数组

5

我正在使用DotNetZip将一个从文件系统中读取的文件添加到一个zip归档文件中。我想把生成的ZipFile转换成byte[]数组。非常感谢您的帮助。下面是我的代码。

public byte[] AddPrjFile(FileStream shapeFileZip, Uri prjLocation)
{
    string prjFileAbsPath = prjLocation.AbsolutePath;
    using (ZipFile zip = ZipFile.Read(shapFileZip))
    {
        ZipEntry e = zip.AddFile(prjFileAbsPath);
        e.FileName = zipFile.Name + ".prj";
    }

    return byte_array;
}
1个回答

13

问题实际上是如何将ZipFile的实例转换为字节数组,而不是FileStream。 - Alex Konnen

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接