On 12/24/2009 7:34 AM, samwyse wrote:
I've got an app that's creating Open Office docs; if you don't know, these are actually ZIP files with a different extension. In my case, like many other people, I generating from boilerplate, so only one component (content.xml) of my ZIP file will ever change. Instead of creating the entire ZIP file each time, what is the cheapest way to accomplish my goal? I'd kind-of like to just write the first part of the file as a binary blob, then write my bit, then write most of the table of contents as another blob, and finally write a TOC entry for my bit. Has anyone ever done anything like this? Thanks.
You might want to look at solid and non-solid compression. Solid compression writes all files in the binary as one huge block and must be compressed/decompressed as a whole, while non-solid compression writes the zipped file in chunks that can be decompressed individually.
I don't know if there's any way to compress/decompress/recompress as non-solid compression from python though. Maybe others can point something out, or maybe you can use an external zipper that understands non-solid compression.
-- http://mail.python.org/mailman/listinfo/python-list