Download a file

@param String $path Local path to a file, or a url.
@return Void
196439
protected function _downloadFile($path) {
        // Push up memory_limit to deal with large files
        $mem = new Garp_Util_Memory();
        $mem->useHighMemory();

        $bytes = @file_get_contents($path);
        if (!$bytes) {
            throw new Zend_Controller_Action_Exception('File not found.', 404);
        }

        $download = Zend_Controller_Action_HelperBroker::getStaticHelper('download');
        $download->force($bytes, basename($path), $this->_response);

        Zend_Controller_Front::getInstance()->setParam('noViewRenderer', true);
        $this->_helper->viewRenderer->setNoRender();
    }
1163237
function download($file_pointer) {
    if (empty($this->download_url)) {
      $this->_save(Recurly_Client::GET, $this->getHref());
    }
    $this->_client->getFile($this->download_url, $file_pointer);
  }
387299
public function setDownloadPath($downloadPath)
    {
        if (!is_dir($downloadPath) || !is_writable($downloadPath)) {
            trigger_error('Cannot write to directory: ' . $downloadPath, E_USER_ERROR);
        }
        $this->downloadPath = $downloadPath;
    }
827331
public function download($path, $removeDownloadedFile = false)
    {
        if(!file_exists($path)) {
            throw new Exception("File [ $path ] not found.");
        }

        $filename = pathinfo($path, PATHINFO_BASENAME );

        header("Content-Description: File Transfer");
        header("Content-Type: application/octet-stream");
        header("Content-Disposition: attachment; filename=\"$filename\"");

        @readfile($path);

        if($removeDownloadedFile) {
            @unlink($path);
        }
    }
169643
public function downloadStream($path)
    {
        $url = $this->getDownloadUrlForFile($path);
        $input = $this->getStreamForUrl($url);

        $output = fopen('php://temp', 'w+');
        if ($output === false) {
            throw new OneDriveClientException('Error when saving the downloaded file');
        }

        while (!$input->eof()) {
            $writeResult = fwrite($output, $input->read(8192));
            if ($writeResult === false) {
                throw new OneDriveClientException('Error when saving the downloaded file');
            }
        }

        $input->close();

        rewind($output);

        return $output;
    }
126593
public function file($path)
    {
        try {
            $contents = $this->filesystem->read($this->localPath."/{$path}");

            return preg_split("/\r\n|\n|\r/", $contents);
        } catch (Flysystem\FileNotFoundException $e) {
            throw new CompilerException($e->getMessage(), null, $e->getCode(), $e);
        }
    }
875156
public function build($path)
    {
        $fileName = $path . '.html';
        if (!file_exists($fileName))
        {
            touch($fileName);
        }
        file_put_contents($fileName, $this->buffer);
    }
736624
private function loadFile(string $path)
    {
        if (!file_exists($path)) {
            throw new Exception('Configuration file "' . $path . '" is not found');
        }

        if (!is_readable($path)) {
            throw new Exception('Configuration file "' . $path . '" is not readable');
        }

        // Include file
        $content = include $path;

        if (!\is_array($content)) {
            throw new Exception("Passed file \"$path\" is not array");
        }

        return $content;
    }
1129389
public function XServeAsDownload($path){

        $this->isFileOrDie($path);

        $this->downloadHeaders($path);
        $this->XServe($path);

    }
433584
public function autoloadPath($path)
    {
        $files = glob($path);
        if ($files && count($files)) {
            foreach ($files as $file) {
                if (file_exists($file) && is_dir($file)) {
                    $this->autoloadPath($file . "/*");
                }
                if (file_exists($file) && is_file($file)) {
                    require_once($file);
                }
            }
        }
    }
1080072
public function setPath(?string $path) : void
    {
        if (strpos($path, "/") !== 0) {
            $path = "/" . $path;
        }
        $this->path = $path;
    }
210893
final public function getFileContents($path)
    {
        return $this->getRepositoryContent()->download(
            $this->settings->getVendor(),
            $this->settings->getPackage(),
            $path,
            $this->settings->getReference()
        );
    }
584679
private function makeDirectory($path)
    {
        if ($this->isSFTP()) {
            $created = @$this->ftp->mkdir($path, true);
        } else {
            $created = @ftp_mkdir($this->ftp, $path);
        }
        if (!$created) {
            $this->fail("couldn't make directory {$path}");
        }
        $this->debug("Make directory: {$path}");
    }
553177
public static function download($path = false, $extension = false, $name = false) {

        if($path && File::isFile($path)) {

            if(!$extension) {
                $extension = File::extension($path);
            }

            if(!$name) {
                $name = basename($path);
            }

            header('Content-Type: application/' . $extension);
            header("Content-Transfer-Encoding: Binary");
            header("Content-disposition: attachment; filename=" . $name);
            readfile($path);
            exit();
        }

        return false;
    }
630254
public function compile($path)
	{

                // get the template data
                $string = $path->template;

		// Compile to PHP
		$contents = $this->compileString($string);

                // check/save cache
		if ( ! is_null($this->cachePath))
		{
			$this->files->put($this->getCompiledPath($path), $contents);
		}
	}
578599
private function loadFromFile($path)
    {
        if ( ! is_file($path)) {
            return;
        }
        
        $config = require_once $path;
        
        if (is_array($config)) {
            $this->config = $config;
        }
    }
426391
protected function load(string $path): void
    {
        $namespace = $this->app->getNamespace();

        /** @var SplFileInfo[] $files */
        $files = (new Finder)->in($path)->files();

        foreach ($files as $file) {
            $file = $namespace.str_replace(
                    ['/', '.php'],
                    ['\\', ''],
                    Str::after($file->getPathname(), app_path().DIRECTORY_SEPARATOR)
                );

            if (is_subclass_of($file, Intent::class) && !(new ReflectionClass($file))->isAbstract()) {
                $this->app['conversation']->registerIntent($file);
            }
        }
    }