summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/file/src/Upload/InputStreamFileWriterInterface.php
blob: f30c18c77188ac5089482f74816a64e2af0c15ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

namespace Drupal\file\Upload;

/**
 * Uploads files from a stream.
 */
interface InputStreamFileWriterInterface {


  /**
   * The length of bytes to read in each iteration when streaming file data.
   */
  const DEFAULT_BYTES_TO_READ = 8192;

  /**
   * The default stream.
   */
  const DEFAULT_STREAM = "php://input";

  /**
   * Write the input stream to a temporary file.
   *
   * @param string $stream
   *   (optional) The input stream.
   * @param int $bytesToRead
   *   (optional) The length of bytes to read in each iteration.
   *
   * @return string
   *   The temporary file path.
   */
  public function writeStreamToFile(string $stream = self::DEFAULT_STREAM, int $bytesToRead = self::DEFAULT_BYTES_TO_READ): string;

}