CloudConvert\Process::downloadStream PHP Method

downloadStream() public method

Download process files from API and write to a given stream
public downloadStream ( resource $stream, string $remotefile = null ) : Process
$stream resource Stream to write the downloaded data to
$remotefile string Remote file name which should be downloaded (if there are multiple output files available)
return Process
    public function downloadStream($stream, $remotefile = null)
    {
        if (!isset($this->output->url)) {
            throw new Exceptions\ApiException("There is no output file available (yet)", 400);
        }
        $local = \GuzzleHttp\Psr7\stream_for($stream);
        $download = $this->api->get($this->output->url . (isset($remotefile) ? '/' . rawurlencode($remotefile) : ''), false, false);
        $local->write($download);
        return $this;
    }