@param $fileName

@return \GuzzleHttp\Stream\StreamInterface|null
@throws ClientException
165666
protected function readData($fileName)
    {
        $client   = new Client([ 'defaults' => [ 'timeout' => $this->getConfiguration()->getTimeout() ] ]);
        $response = $client->get($fileName);

        return $response->getBody();
    }
1269193
public function create($filename)
    {
        if ($this->exists($filename)) {
            $message = sprintf('Failed to create "%s" because its path is not accessible.', $filename);

            throw new IOException($filename, $message);
        }

        return $this->makeFile($filename, '');
    }
769397
public function load( $fileName )
    {
        $file = new MFileInfo( $fileName );
        $resource = false;
        $this->type = $file->getSuffix();

        if( $this->type == "png" )
        {
            $resource = imageCreateFromPng( $fileName );
            if( $resource )
            {
                imageAlphaBlending( $resource, true );
                imageSaveAlpha( $resource, true );
            }
        }
        else
        {
            if( $this->type == "gif" )
            {
                $resource = imagecreatefromgif( $fileName );
            }
            else
            {
                if( $this->type == "jpg" || $this->type == "jpeg" )
                {
                    $resource = imagecreatefromjpeg( $fileName );
                }
                else
                {
                    return false;
                }
            }
        }

        if( $resource === false )
        {
            return false;
        }

        $this->resource = $resource;
        $this->fileName = $fileName;
        $this->width = imagesx( $this->resource );
        $this->height = imagesy( $this->resource );

        return true;
    }
330983
public function getChildScanner($filename)
    {
        // HACK - pretty mode should be reflected elsewhere than here.
        if (!$this->prettyMode) {
            return null;
        }
        // $luminous_ is a singleton from the main calling API. It may or may not
        // exist here, but if it does, we're going to use it.
        global $luminous_;
        if (!isset($luminous_)) {
            return null;
        }

        $spos = strrpos($filename, '.');
        if ($spos === false) {
            return null;
        }
        $ext = substr($filename, $spos + 1);
        $s = $luminous_->scanners->getScanner(strtolower($ext));
        // we actually only want the classname, not an instance.
        if ($s === null) {
            return null;
        }
        return get_class($s);
    }
739200
function getClient($clientName)
    {
        if (! isset($this->clients[$clientName]) )
            // if not client constructed look for lazy options:
            $this->clients[$clientName] = $this->_attainClient($clientName);


        return $this->clients[$clientName];
    }
891892
public static function filename2url($filename)
    {
        $filename = realpath($filename);
        if (!$filename) {
            return null;
        }

        // Filter files outside of the webroot
        $base = realpath(BASE_PATH);
        $baseLength = strlen($base);
        if (substr($filename, 0, $baseLength) !== $base) {
            return null;
        }

        $relativePath = ltrim(substr($filename, $baseLength), '/\\');
        return Director::absoluteURL($relativePath);
    }
1056751
public static function load( $fileName )
	{
		$file	= new FS_File_Reader( $fileName );
		if( !$file->exists() )
			throw new Exception( "File '".$fileName."' is not existing." );
		$xml	= $file->readString();
		$parser	= new XML_OPML_Parser();
		return $parser->parse( $xml );
	}
699929
public function get($filename)
    {
        if (!$stream = $this->readStream($filename)) {
            return false;
        }

        $contents = stream_get_contents($stream);

        fclose($stream);

        return $contents;
    }
721363
public static function createStreamFromFile($filename, $mode = 'r')
    {
        if (! static::$streamFactory) {
            static::$streamFactory = new StreamFactory();
        }

        return static::$streamFactory->createStreamFromFile($filename, $mode);
    }
201011
public static function StreamOrDownloadOctetStream(
        string $octetStream,
        string $fileName,
        bool $inlineDisposition = true
    ): StreamedResponse
    {
        $response = new StreamedResponse(function () use ($octetStream) {
            $handle = fopen('php://output', 'rb+');

            fwrite($handle, $octetStream);

            fclose($handle);
        });

        $response->headers->set(
            'Content-Type',
            MimeTypeExtensionTrait::getMimeType(
                static::getExtension($fileName)
            ));
        $response->headers->set(
            'Content-Disposition',
            $response->headers->makeDisposition(
                (
                $inlineDisposition === true
                    ?
                    ResponseHeaderBag::DISPOSITION_INLINE
                    :
                    ResponseHeaderBag::DISPOSITION_ATTACHMENT
                ),
                $fileName
            )
        );
        // $response->send();

        return $response;
    }
1163654
public function get($filename, $includePath = false, $streamContext = null)
    {
        return file_get_contents($filename, $includePath, $streamContext);
    }
301373
public function parse($stream, $filename = null)
    {
        $this->stream = $stream;
        $this->filename = $filename;
        $this->variables = array();

        return $this->parseMain();
    }
1150856
protected function fileOrUrl($filename)
    {
        $options = array();
        if (!empty($this->httpBasicAuth) || !empty($this->httpUserAgent)) {
            $options['http'] = array();
            $options['http']['header'] = array();

            if (!empty($this->httpBasicAuth)) {
                $username  = $this->httpBasicAuth['username'];
                $password  = $this->httpBasicAuth['password'];
                $basicAuth = base64_encode("{$username}:{$password}");

                array_push($options['http']['header'], "Authorization: Basic {$basicAuth}");
            }

            if (!empty($this->httpUserAgent)) {
                array_push($options['http']['header'], "User-Agent: {$this->httpUserAgent}");
            }
        }

        $context = stream_context_create($options);

        if (($lines = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES, $context)) === false) {
            throw new \Exception("The file path or URL '{$filename}' does not exist.");
        }

        return $lines;
    }
938338
public function getFile( $fileName )
    {
        if ( !isset( $this->storage->_attachments[$fileName] ) )
        {
            throw new phpillowNoSuchPropertyException( $fileName );
        }

        $attachment = $this->storage->_attachments[$fileName];

        return new phpillowLazyFile(
            $this->getConnection(),
            $this->getDatabase() . urlencode( $this->_id ) . '/' . $fileName,
            $attachment['content_type'],
            $attachment['length']
        );
    }
420672
private function outputBuffer($filename = null, $output = false)
    {
        if (!$this->resource) {
            return $this;
        }

        if ($output) {
            $filename = null;
        } elseif (empty($filename) && $this->isLocal()) {
            $filename = $this->filename;
        } elseif (empty($filename) && $this->isExternal()) {
            $filename = $this->name;
        }

        if ($output) {
            header('Content-type: ' . $this->mimetype);
            ob_start();
        }

        $this->outputBufferByImage($filename, $this->quality);

        if ($output) {
            ob_end_flush();
        }

        if (!$this->preserve) {
            $this->destroy();
        }

        return $this;
    }
910212
function stream($filename, $options = null) {
		//Helpers::dompdf_debug("trace", "($filename, $options)");

		// Add page text
		$this->_add_page_text();
		$this->_add_internal_links();

		// TCPDF expects file name with extension (cf. Cpdf expects file name without extension) //***
		if (!preg_match('/\.pdf$/', $filename))
			$filename .= ".pdf";

		$options["Content-Disposition"] = $filename;

		if ( isset($options["compress"]) && $options["compress"] == 0 )
		$compress = false;
		else
		$compress = true;

		$this->_pdf->SetCompression($compress);

		$this->_pdf->Output($filename, $options["Attachment"] ? "D" : "I"); // ***
	}
59878
public static function parseFromFile($filename)
    {
        if (file_exists($filename) && is_readable($filename)) {
            return new self(file_get_contents($filename));
        } else {
            throw new \RuntimeException(sprintf("File %s is not readable, or doesn't exist.", $filename));
        }
    }