I am trying to create a Zip file in .NET 4.5 (System.IO.Compression) from a series of byte arrays. As an example, from an API I am using I end up with a List<Attachment>
and each Attachment
has a property called Body
which is a byte[]
. How can I iterate over that list and create a zip file that contains each attachment?
Right now I am under the impression that I would have to write each attachment to disk and create the zip file from that.
//This is great if I had the files on disk
ZipFile.CreateFromDirectory(startPath, zipPath);
//How can I create it from a series of byte arrays?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…