[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [office] MIME types
Hi all, Michael Brauer wrote: > If a MIME type for a document that makes use of packages is existing, > then the package SHOULD contain a stream called "mimetype", and this > stream SHOULD be first stream of the package's zip file. This stream > SHOULD contain the document's MIME type, but no additional bytes. I have two amendments to make: This stream MUST NOT be compressed. This stream MUST NOT use 'extra header data'. The purpose is to allow packaged files to be identified through 'magic number' mechanisms, such as Unix's file/magic utility. If a ZIP file contains a stream 1) at the beginning of the file, 2) uncompressed, and 3) without extra data in the header, then the stream name and the stream content can be found at fixed positions. More specifically, you will find: - a string 'PK' at pos 0 of all zipfiles - a string 'mimetype' at pos 30 of all such package files - the mimetype itself at pos 38 of such a package. In a text editor, a package would look roughly like this: PK[...28 chars...]mimetypeapplication/vnd.sun.xml.writer[...other stuff...] On 'extra data': ZIP files allow for a rarely used feature called 'extra data' in file headers. This can be used to store additional file meta data (like permissions or extended attributes) that are not part of the standard header file. These 'extra data' fields are usually OS specific, and of variable length; hence, they disturb the fixed positions mentioned above. Most tools/libraries do not use 'extra data' anyway, so in terms of implementation effort this is usually a non-issue. Sincerely, Daniel
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]