zippackage to eliminate timestamp

1 posts, 0 answers
  1. ajin prasad
    ajin prasad avatar
    19 posts
    Member since:
    May 2010

    Posted 18 Sep 2013 Link to this post


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

Back to Top