Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. StreamFactoryInterface.php

function StreamFactoryInterface::createStreamFromFile

Create a stream from an existing file.

The file MUST be opened using the given mode, which may be any mode supported by the `fopen` function.

The `$filename` MAY be any string supported by `fopen()`.

Parameters

string $filename Filename or stream URI to use as basis of stream.:

string $mode Mode with which to open the underlying filename/stream.:

Return value

StreamInterface

Throws

\RuntimeException If the file cannot be opened.

\InvalidArgumentException If the mode is invalid.

2 methods override StreamFactoryInterface::createStreamFromFile()
HttpFactory::createStreamFromFile in vendor/guzzlehttp/psr7/src/HttpFactory.php
Create a stream from an existing file.
Psr17Factory::createStreamFromFile in vendor/php-http/discovery/src/Psr17Factory.php
Create a stream from an existing file.

File

vendor/psr/http-factory/src/StreamFactoryInterface.php, line 33

Class

StreamFactoryInterface

Namespace

Psr\Http\Message

Code

public function createStreamFromFile(string $filename, string $mode = 'r') : StreamInterface;

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal