   #PHP Manual Bzip2 Compression Functions bzopen bzwrite

   PHP Manual
   Prev  Next
   ______________________________________________________________________

                                    bzread

   (4.0.4 - 4.3.2 only)
   bzread -- Binary safe bzip2 file read

Description

   string bzread ( resource bz [, int length])

   bzread() reads up to length bytes from the bzip2 file pointer
   referenced by bz. Reading stops when length (uncompressed) bytes have
   been read or EOF is reached, whichever comes first. If the optional
   parameter length is not specified, bzread() will read 1024
   (uncompressed) bytes at a time.

   Example 1. bzread() 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 /tmp/foo.bz2 are: <br />\n";
   echo $decompressed_file;
   ?>

   See also bzwrite(), feof(), and bzopen().
   ______________________________________________________________________

   Prev   Home    Next
   bzopen  Up  bzwrite
