BZREAD(3) 1 BZREAD(3)
bzread - Binary safe bzip2 file read
SYNOPSIS
string bzread (resource $bz, [int $length = 1024])
DESCRIPTION
bzread(3) reads from the given bzip2 file pointer.
Reading stops when $length (uncompressed) bytes have been read or EOF is reached, whichever comes first.
PARAMETERS
o $bz
- The file pointer. It must be valid and must point to a file successfully opened by bzopen(3).
o $length
- If not specified, bzread(3) will read 1024 (uncompressed) bytes at a time. A maximum of 8192 uncompressed bytes will be read at
a time.
RETURN VALUES
Returns the uncompressed data, or FALSE on error.
EXAMPLES
Example #1
bzread(3) example
<?php
$file = "/tmp/foo.bz2";
$bz = bzopen($file, "r") or die("Couldn't open $file");
$decompressed_file = '';
while (!feof($bz)) {
$decompressed_file .= bzread($bz, 4096);
}
bzclose($bz);
echo "The contents of $file are: <br />
";
echo $decompressed_file;
?>
SEE ALSO
bzwrite(3), feof(3), bzopen(3).
PHP Documentation Group BZREAD(3)