Download in $downloadDir the $key file from storage

@param string $key
@param string $downloadDir

@return string
15590
public function downloadFile($key, $downloadDir)
    {
        if ($this->exists($key)) {
            $downloadedFilePath = $downloadDir . DIRECTORY_SEPARATOR . $key;
            $fileHandler = fopen($downloadedFilePath, 'a');
            fwrite($fileHandler, $this->getFileContent($key));
            fclose($fileHandler);

            return $downloadedFilePath;
        }

        return '';
    }
1336893
public function download($url)
    {
        $context = $this->getContext($url);

        return file_get_contents($url, false, $context);
    }
542798
public function fetch($key)
    {
        $file_name = $this->getFilePath($key);
        if (!\file_exists($file_name) || !\is_readable($file_name)) {
            return false;
        } else {
            $h = \fopen($file_name, 'r');
            //lock file
            \flock($h, LOCK_SH);
        }

        $data = \file_get_contents($file_name);

        //release lock
        \fclose($h);

        $data = @\unserialize($data);

        //check to see if it expired
        if ($data && ($data[0] == 0 || time() <= $data[0])) {
            return $data[1];
        } else {
            $this->delete($key);
            return false;
        }

        return $data[1];
    }
752138
public function download($ftkey, $size, $passthru = FALSE)
  {
    $this->init($ftkey);

    if($passthru)
    {
      return $this->passthru($size);
    }

    $buff = new Str("");
    $size = intval($size);
    $pack = 4096;

    Signal::getInstance()->emit("filetransferDownloadStarted", $ftkey, count($buff), $size);

    for($seek = 0;$seek < $size;)
    {
      $rest = $size-$seek;
      $pack = $rest < $pack ? $rest : $pack;
      $data = $this->getTransport()->read($rest < $pack ? $rest : $pack);
      $seek = $seek+$pack;

      $buff->append($data);

      Signal::getInstance()->emit("filetransferDownloadProgress", $ftkey, count($buff), $size);
    }

    $this->getProfiler()->stop();

    Signal::getInstance()->emit("filetransferDownloadFinished", $ftkey, count($buff), $size);

    if(strlen($buff) != $size)
    {
      throw new Exception("incomplete file download (" . count($buff) . " of " . $size . " bytes)");
    }

    return $buff;
  }
1063940
public function onDownload(DownloadResourceEvent $event)
    {
        $ds = DIRECTORY_SEPARATOR;
        $scorm = $event->getResource();
        $workspace = $scorm->getResourceNode()->getWorkspace();
        $event->setItem($this->filesDir.$ds.'scorm'.$ds.$workspace->getUuid().$ds.$scorm->getHashName());
        $event->setExtension('zip');
        $event->stopPropagation();
    }
756526
public function download($url, $directory)
    {
        coollect((array) $url)->each(function ($url) use ($directory) {
            $filename = basename($url);

            $destination = $this->toDir("{$directory}/{$filename}");

            $this->message("Downloading to {$destination}");

            $this->mkDir($directory);

            $this->downloadFile($url, $destination);
        });
    }
110363
public function download()
    {
        $basedir = dirname($this->fileName);
        foreach ($this->data as $fetch) {
            $filename = $basedir . '/' . $fetch['filename'];
            if (! file_exists($filename)) {
                $this->_downloadFile($fetch['url'], $filename);
            }
        }
    }
864371
public function deleteFromId( $download_id){
        $rest = $this->getService( self::API_DOWNLOAD . $download_id);
        $rest->DELETE();

        return $rest->getSuccess();
    }
188618
public function download(string $callback = "")
    {
        $parameters = [];

        if (!empty($callback) && is_string($callback)) {
            $parameters['callback_url'] = $callback;
        }

        return static::query($this->client, [$this->fillable_form_id, self::DOWNLOAD_URI], $parameters);
    }
312127
public function getLogFromId($download_id)
    {
        $logService = sprintf(self::API_DOWNLOAD_LOG, $download_id);
        $result     = $this->callService('GET', $logService);

        return $result->getResult();
    }
41867
public static function get($key)
    {
        $path = Cache::path($key);

        if (file_exists($path)) {
            return file_get_contents($path);
        }

        return null;
    }
648969
public function mkdir($key, $ttl = 0)
    {
        $data = array('dir' => 'true');

        if ($ttl) {
            $data['ttl'] = $ttl;
        }
        try {
            $response = $this->guzzleclient->put(
                $this->buildKeyUri($key),
                array(
                    'query' => array('prevExist' => 'false'),
                    'form_params' => $data
                )
            );
        } catch (BadResponseException $e) {
            $response = $e->getResponse();
        }
        $body = json_decode($response->getBody(), true);
        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new RuntimeException('Unable to parse response body into JSON: ' . json_last_error());
        }

        if (isset($body['errorCode'])) {
            throw new KeyExistsException($body['message'], $body['errorCode']);
        }
        return $body;
    }
183780
public function DownloadAction(Request $request, $path)
    {
        /** @var FileManagerService $service */
        $service = $this->get('youwe.file_manager.service');
        $service->checkToken($request->get('token'));

        /** @var FileManagerDriver $driver */
        $driver = $this->get('youwe.file_manager.driver');
        $parameters = $this->container->getParameter('youwe_file_manager');
        $fileManager = $service->createFileManager($parameters, $driver);

        $filepath = $fileManager->getPath($path, null, true);
        $content = file_get_contents($filepath);
        $filename = basename($path);
        $response = new Response();

        $response->headers->set('Content-Type', 'mime/type');
        $response->headers->set('Content-Disposition', 'attachment;filename="' . $filename . '"');
        $response->setContent($content);

        return $response;
    }
1364616
public function getConfigHeader($key)
    {
        $path = $this->getDir() . 'config/header/' . $key . '.conf.php';
        if (is_readable($path) && is_file($path)) {
            return file_get_contents($path);
        }
        return null;
    }
287817
public function downloadAttachment($url)
	{
		$result = $this->client->sendRequest(
			self::REQUEST_GET,
			$url,
			array(),
			null,
			$this->authentication,
			true,
			false
		);

		return $result;
	}
1129211
public function do_get($key)
    {
        $file = $this->_getFileName($key);

        if (@filemtime($file) >= time()) {
            return file_get_contents($file);
        } else {
            return false;
        }
    }
1048481
public function get($key)
    {
        if (!$this->has($key)) {
            return null;
        }

        $file = $this->directory . substr(md5($this->prefix() . $key), 0, 10) . '.dat';

        return unserialize(file_get_contents($file));
    }