note 128233 added to filters.compression
| From: | TingSong at main dot php dot net | Date: | Mon, 20 Feb 2023 03:43:16 +0000 |
| Subject: | note 128233 added to filters.compression | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220190@lists.php.net to get a copy of this message | ||
To decompress a gzipped stream:
<?php
$stream = fopen('https://example.com/some/file.txt.gz',
'rb');
stream_filter_append($stream, 'zlib.inflate', STREAM_FILTER_READ, ['window'
=> 15+16]);
// read the decompressed line directly
$line = fgets($stream);
// process the lines
?>
As the doc of zlib https://www.zlib.net/manual.html#Advanced
The 'window' parameter between 8 and 15 specified the window size from 2⸠to
2¹ⵠbytes. It can be added by 16 for wrapping with gzip header and trailer instead of zlib
wrapper.
And, window could be -8..-15 for unwrapping RAW deflate data.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.130 (proxied: 34.96.169.225)
----
Manual Page -- https://php.net/manual/en/filters.compression.php
Edit -- https://main.php.net/note/edit/128233
Del: integrated -- https://main.php.net/note/delete/128233/integrated
Del: useless -- https://main.php.net/note/delete/128233/useless
Del: bad code -- https://main.php.net/note/delete/128233/bad+code
Del: spam -- https://main.php.net/note/delete/128233/spam
Del: non-english -- https://main.php.net/note/delete/128233/non-english
Del: in docs -- https://main.php.net/note/delete/128233/in+docs
Del: other reasons-- https://main.php.net/note/delete/128233
Reject -- https://main.php.net/note/reject/128233
Search -- https://main.php.net/manage/user-notes.php