I am trying to create a zip file from a stream and in return a stream, my problem is I don't want to store any data in my local hard disk or in memory. I am using Ionic.Zip
Library
Stream output = new MemoryStream();
using (ZipFile zip = new ZipFile())
{
Stream s = ftpManager.GetFileStream("/mydoc.docx");
ZipEntry e = zip.AddEntry("Content-From-Stream.bin", s);
e.Comment = "The content for entry in the zip file was obtained from a stream";
//zip.AddFile("Readme.txt");
zip.Save(output);
}
if (output != null)
{
ftpManager.Upload(output, "/MohamedTest/mydoc.zip");
}
There are many problems in that code,
any suggestions
Most likely position on output is set to the end of stream after compression, please check this. And, unless you will implement some proxyfying stream (which will handle .Write method and send this data to FTP) you need memory/file stream to store the zipped data.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.