maennchen/ZipStream-PHP

How to compress output while writing content?

RLOFLS opened this issue · 2 comments

Description of the problem

describe:
Create a temporary file, then compress the output while writing the content,
egeg: write 'A...' into tempfile
-> zipStream output 'A...'
-> write 'B...' into tempfile
-> zipStream output 'B...'
....
->finish write
-> zipStrean output finished
Can this be done?

Informations

  • ZipStream-PHP version:2.1.0
  • PHP version:7.2

You don't need Zipstream for that. You can just use the standard zip package.

https://www.php.net/manual/en/book.zip.php

The selling point of Zipstream is that is doesn't need a temp file or any sort of write access to the file system but that comes with limitations.

Yes, if you create a temporary file you defeat the purpose of this lib, which is to stream content directly to the browser.