Hi,
using (MemoryStream ms = new MemoryStream())
{
using (StreamWriter w = new StreamWriter(ms, Encoding.UTF8))
{
w.WriteLine("application/epub+zip");
}
//add mimetype to zip package already created
using (ZipPackage zipPackage = ZipPackage.CreateFile(path))
{
MemoryStream msMimetype = new MemoryStream(ms.ToArray());
msMimetype.Seek(0, SeekOrigin.Begin);
zipPackage.AddStream(msMimetype, "mimetype");
}
}
I am using the following line to create a file and add to zippackage. This is a mimetype file of epub. when I unzip the file and check, it contains only "application/epub+zip". But the epub validator throws the error "Mimetype file should contain only the string "application/epub+zip".". So after some time spent in google shows me something like that the file may contain timestamp information.
This data will appear in the zip file immediately after the filename, and immediately before the file content. Dotnetzip has something like EmitTimesInWindowsFormatWhenSaving . setting this value will eliminate timestamp. do telerik zippackage has something like that.using (MemoryStream ms = new MemoryStream())
{
using (StreamWriter w = new StreamWriter(ms, Encoding.UTF8))
{
w.WriteLine("application/epub+zip");
}
//add mimetype to zip package already created
using (ZipPackage zipPackage = ZipPackage.CreateFile(path))
{
MemoryStream msMimetype = new MemoryStream(ms.ToArray());
msMimetype.Seek(0, SeekOrigin.Begin);
zipPackage.AddStream(msMimetype, "mimetype");
}
}