Torrent::fopen PHP Method

fopen() public static method

Helper to open file to read (even bigger than 2Gb, linux only)
public static fopen ( $file, $size = null ) : ressource | boolean
return ressource | boolean file handle or false if error
    public static function fopen($file, $size = null)
    {
        if ((is_null($size) ? self::filesize($file) : $size) <= 2 * pow(1024, 3)) {
            return fopen($file, 'r');
        } elseif (PHP_OS != 'Linux') {
            return self::set_error(new Exception('File size is greater than 2GB. This is only supported under Linux'));
        } elseif (!is_readable($file)) {
            return false;
        } else {
            return popen('cat ' . escapeshellarg(realpath($file)), 'r');
        }
    }