6

Is there an easy interface like ZipArchive for tar.gz archives that allows me to stream the archive to the client rather than save it on the server? And if so, could someone show me how?

Thanks!

2 Answers2

3

You can direct the tar command with passthru() or exec() to send the tar.gz file to stdout. E.g.

tar cfz - name1 name2 ...
Mark Adler
  • 89,031
  • 13
  • 106
  • 147
-1

This link may be useful to you. Can you be more specific on not wanting the file to be temporarily on the filesystem?

http://www.clker.com/blog/2008/03/27/creating-a-tar-gz-on-the-fly-using-php/

organicit
  • 28
  • 2
  • 2
    The link is broken now. That is why SO wants us to quote the relevant part. Without the link the answer is useles. So, sorry, but -1 until fixed – Paul van Leeuwen Apr 07 '17 at 03:46