Page MenuHomeWickedGov Phorge

InputFileFromStream.php
No OneTemporary

Size
787 B
Referenced Files
None
Subscribers
None

InputFileFromStream.php

<?php
namespace Shellbox\Command;
use GuzzleHttp\Psr7\Utils;
use Psr\Http\Message\StreamInterface;
use Shellbox\FileUtils;
class InputFileFromStream extends InputFileWithContents {
/** @var StreamInterface */
private $stream;
/**
* @internal
* @param StreamInterface $stream
*/
public function __construct( StreamInterface $stream ) {
$this->stream = $stream;
}
public function copyTo( $destPath ) {
// Rewind for consistency with getStreamOrString()
$this->stream->rewind();
Utils::copyToStream( $this->stream, FileUtils::openOutputFileStream( $destPath ) );
}
public function getStreamOrString() {
// The client needs to read it twice.
// Rewind, otherwise we may get different results each time.
$this->stream->rewind();
return $this->stream;
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Oct 3, 13:07 (2 d, 3 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
38/5c/fe83a1eace884e4e8c20d563c056
Default Alt Text
InputFileFromStream.php (787 B)

Event Timeline