- From: Glenn Maynard <glenn@zewt.org>
- Date: Tue, 14 Aug 2012 16:33:39 -0500
- To: Tobie Langel <tobie.langel@gmail.com>
- Cc: "whatwg@whatwg.org" <whatwg@whatwg.org>, Andrea Marchesini <baku@mozilla.com>
(Please remember to trim quotes.) On Tue, Aug 14, 2012 at 4:05 PM, Tobie Langel <tobie.langel@gmail.com>wrote: > How are nested directories handled in your counter proposal? > The ZIP directory is simply a list of files anyway. Just store the complete path of the file in .name: zipFile.files[0].name == "file.txt" zipFile.files[1].name == "path/file.txt" Don't expose an entry for "path" itself. This doesn't give a way to expose the existance of empty directories, which I suppose might be useful (the original proposal doesn't do that, either). This could be handled if wanted, with a separate .directories array containing just a list of DOMStrings ("path"), though I wouldn't bother unless there was demand. Oh, one other thing: sort .files by disk order, eg. by the "relative offset of local header" field in the CD file entry. (This is usually the order files appear in the central directory itself, but this isn't guaranteed.) This guarantees the order of .files is predictable. Also, if the page reads all files sequentially from the ZIP in this order, the actual file will be traversed sequentially. That's much faster than reading them out of order, especially for lots of small files. -- Glenn Maynard
Received on Tuesday, 14 August 2012 21:34:54 UTC