I need to create a zip file containing a folder structure and be able to add files from a memory stream to specific folders.

I am trying to achieve this with dotnetZip but they seem to have dropped support for adding a file by stream to a specific folder.

All examples I can find use the following:

zip.AddEntry("test.txt", "folder", memoryStream);

But this method no longer allows you to add a folder name into which to add the file.

zip.AddEntry("test.txt", memoryStream);

How can I use dotnetZip to create a child folder in a zip file and add a memoryStream file to that folder without having to save to disk?

有帮助吗?

解决方案

Entry path can include directories inside of archive, so you should first

.AddEntry("folderName/")

, next -

.AddEntry("folderName/filename.txt", memoryStream);

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top