This is a migrated thread and some comments may be shown as answers.

[Solved] zippackage to eliminate timestamp

0 Answers 95 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
ajin prasad
Top achievements
Rank 1
ajin prasad asked on 18 Sep 2013, 07:25 AM
Hi,

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");

                }
            }
Tags
General Discussions
Asked by
ajin prasad
Top achievements
Rank 1
Share this question
or