@noeska:
For your compression you could always give DIUcl (Link) a try. It supports in-memory (de)compression and working with streams.
I used it for my own file packer and it managed reasonably well. However, it had trouble with some files that were already compressed at a better ratio. I just put a check in to "store" those files rather than compress them.