in reply to Creating files within a .zip

Is this perhaps an XY Problem? Why can't you create your file foo/bar.txt and then create/add it to the archive?

To my (possibly flawed) understanding, you are correct that you cannot open a writable file inside a zip archive. This should make sense, given that compression algorithms in general need to analyze a complete file in order to determine how to compress the file effectively.

Perhaps File::Temp's tempdir would be helpful here?


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Replies are listed 'Best First'.
Re^2: Creating files within a .zip
by wumpus42 (Novice) on Sep 28, 2012 at 15:33 UTC
    I can certainly create the file(s) first, and I've been doing that. But I've got many hundreds of files to put in the .zip file, each one would have to be created on the filesystem then a string buffer written to each first before putting them into a .zip file? I was looking for a way to skip the middle-man step (creating the foo/bar.txt file on the filesystem).