Archived Forum Post

Index of archived forum posts

Question:

Question about Appending File to Zip

Feb 05 '13 at 10:37

If i append/add a file to zip using PHP, does Chilkat writes anything to memory? Like first copy to memory than add to the disk...


Answer

There are two ways to append a file to an existing zip:

1) Open the zip, append files by calling one or more of the Append* methods one or more times, and then write the zip. If appending a file via one of the Append* methods, such as AppendFiles, no file data is read into memory. What happens is that the zip object will now contain entries that point to the files that are to be included in the zip when eventually written. When the zip is written, such as by calling WriteZipAndClose, the file data is streamed from the referenced files directly into the zip. Note: the entire .zip is re-written.

2) A quicker way to append files to an existing .zip is via the QuickAppend method. See the online reference documentation, which includes links to examples for using QuickAppend.