note 128116 added to function.stream-filter-append
| From: | TingSong at main dot php dot net | Date: | Sun, 15 Jan 2023 10:49:19 +0000 |
| Subject: | note 128116 added to function.stream-filter-append | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220071@lists.php.net to get a copy of this message | ||
To decompress a gzipped stream:
<?php
$stream = $s3_client->getReadStream('somefile.csv.gz');
stream_filter_append($stream, 'zlib.inflate', STREAM_FILTER_READ, ['window'
=> 15+16]);
// read the decompressed line directly
$line = fgets($stream);
$columns = str_getcsv($line);
// process the data in columns
?>
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: 45.91.158.213 (proxied: 27.122.58.253)
----
Manual Page -- https://php.net/manual/en/function.stream-filter-append.php
Edit -- https://main.php.net/note/edit/128116
Del: integrated -- https://main.php.net/note/delete/128116/integrated
Del: useless -- https://main.php.net/note/delete/128116/useless
Del: bad code -- https://main.php.net/note/delete/128116/bad+code
Del: spam -- https://main.php.net/note/delete/128116/spam
Del: non-english -- https://main.php.net/note/delete/128116/non-english
Del: in docs -- https://main.php.net/note/delete/128116/in+docs
Del: other reasons-- https://main.php.net/note/delete/128116
Reject -- https://main.php.net/note/reject/128116
Search -- https://main.php.net/manage/user-notes.php