I'm using DotNetZip to add a file to a zip archive, which I've read from the file system. I'd like to convert the resulting ZipFile to byte[] array. Any assistance will be highly appreciated. My code is shown below.
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;
}
You could simply use the File.ReadAllBytes
static method like:
return File.ReadAllBytes( shapeFileZip.Name );
To read from your file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With