Creating a GZipped tar file and dynamically stream

2019-02-22 06:29发布

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条回答
再贱就再见
2楼-- · 2019-02-22 06:53

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

tar cfz - name1 name2 ...
查看更多
何必那么认真
3楼-- · 2019-02-22 06:57

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/

查看更多
登录 后发表回答