CloudConvert\Process::download PHP Method

download() public method

Download process files from API
public download ( string $localfile = null, string $remotefile = null ) : Process
$localfile string Local file name (or directory) the file should be downloaded to
$remotefile string Remote file name which should be downloaded (if there are multiple output files available)
return Process
    public function download($localfile = null, $remotefile = null)
    {
        if (isset($localfile) && is_dir($localfile) && isset($this->output->filename)) {
            $localfile = realpath($localfile) . DIRECTORY_SEPARATOR . (isset($remotefile) ? $remotefile : $this->output->filename);
        } elseif (!isset($localfile) && isset($this->output->filename)) {
            $localfile = isset($remotefile) ? $remotefile : $this->output->filename;
        }
        if (!isset($localfile) || is_dir($localfile)) {
            throw new Exceptions\InvalidParameterException("localfile parameter is not set correctly");
        }
        return $this->downloadStream(fopen($localfile, 'w'), $remotefile);
    }