I am using the following code to zip a file. this is for mimetype of epub file. When i check the file in epub validator, it shows the error "Mimetype file should contain only the string "application/epub+zip".". So i checked the file using
a hex editor and found the mimetype contains the following string.
moreover it should contains 20 byte length and my mimetype is 25 byte length. Additional 3 char at beginning and 2 char at end are added to my string.
Can anyone help me to sort out this issue?
using (MemoryStream ms = new MemoryStream())
//content of the file is static and is used here directly
using (StreamWriter w = new StreamWriter(ms, Encoding.UTF8))
using (ZipFile zip = new ZipFile())
MemoryStream msMimetype = new MemoryStream(ms.ToArray());
zip.Encryption = Ionic.Zip.EncryptionAlgorithm.None;
zip.EmitTimesInUnixFormatWhenSaving = false;
zip.EmitTimesInWindowsFormatWhenSaving = false;
zip.UseZip64WhenSaving = Ionic.Zip.Zip64Option.Never;
zip.CompressionMethod = Ionic.Zip.CompressionMethod.None;
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.None;
zip.Save(System.IO.Path.GetTempPath() + "\\" + FileName);