kjdev / php-ext-zstd

Zstd Extension for PHP
MIT License
201 stars 27 forks source link

Is an "ob_zstdhandler" function possible? #71

Open Ys88 opened 1 month ago

Ys88 commented 1 month ago

Hi!

Firstly congratulations, this a great extension (as well as your others).

I was wondering if you think it could be possible to have an ob_zstdhandler function similar to the ob_gzhandler?

zstd_compress works great with ob_start, but only if the whole page is compressed at once.

If we set a chunk_size when calling ob_start, or if we call ob_flush before ob_end_flush, we can't use zstd_compress.

Using chunk_size or/and ob_flush allows to send data early, so the client can start rendering the page, without having to wait for the entire page to be generated server side.

If this is possible, I think it would be a terrific feature.

Regards,

Edit: I don't know if my question is related to this request Support incremental compression and decompression.