Trying to convert ZipArchiveEntry to byte []

I try to take a list ZipArchiveEntryand convert them to byte arrays, but I logically run into the wall.

While I try to convert it to MemoryStream, to convert it to byte [] as follows:

public static void ScanUpload(List<ZipArchiveEntry> scan)
{
    foreach (var s in scan)
    {                           
        using (var ms = new MemoryStream())
        {

        }
    }
}

But I have no idea what will happen next. or even if this is the right way. Can anyone help?

+4
source share
1 answer

You should be able to read from a stream that returns ZipArchiveEntry.Open():

foreach (var s in scan)
{            
    var stream = s.Open();
    byte[] bytes;
    using (var ms = new MemoryStream())
    {
         stream.CopyTo(ms);
         bytes = ms.ToArray();
    }
}
+11
source

All Articles