Get the signed download url of a file.

@param string $path
@param int    $expires
@param string $host_name
@param bool   $use_ssl
@return string
518969
public function getSignedDownloadUrl($path, $expires = 3600, $host_name = '', $use_ssl = false)
    {
        $object = $this->applyPathPrefix($path);
        $url = $this->client->signUrl($this->bucket, $object, $expires);

        if (! empty($host_name) || $use_ssl) {
            $parse_url = parse_url($url);
            if (! empty($host_name)) {
                $parse_url['host'] = $this->bucket.'.'.$host_name;
            }
            if ($use_ssl) {
                $parse_url['scheme'] = 'https';
            }

            $url = (isset($parse_url['scheme']) ? $parse_url['scheme'].'://' : '')
                   .(
                   isset($parse_url['user']) ?
                       $parse_url['user'].(isset($parse_url['pass']) ? ':'.$parse_url['pass'] : '').'@'
                       : ''
                   )
                   .(isset($parse_url['host']) ? $parse_url['host'] : '')
                   .(isset($parse_url['port']) ? ':'.$parse_url['port'] : '')
                   .(isset($parse_url['path']) ? $parse_url['path'] : '')
                   .(isset($parse_url['query']) ? '?'.$parse_url['query'] : '');
        }

        return $url;
    }
342803
public function sign($url, $expiration = null)
    {
        $expiration = $expiration ? $expiration : config('signed-url.default_expiration_time_in_days');

        return parent::sign($url, $expiration);
    }
903755
public static function download($path = false, $extension = false, $name = false) {

        File::download($path, $extension, $name);
    }
1353036
public function create($path, $expire = 0, $fullUrl = '')
    {
        $Path_b64 = base64_encode($path);
        $expire   = $expire ?: (time() + (60 * 60 * 24)); // If expire is not defined, default is 24h
        $result     = $this->callService('POST', self::API_SHARE_LINK, [
            'path'    => $Path_b64,
            'expire'  => $expire,
            'fullurl' => $fullUrl,
        ]);

        return $result->getModel(models\FileSystem\ShareLink::class);
    }
23695
public String privateDownloadUrl(String baseUrl, long expires) {
        long deadline = System.currentTimeMillis() / 1000 + expires;
        return privateDownloadUrlWithDeadline(baseUrl, deadline);
    }
1154870
public function getTemporaryUrl($path, DateTimeInterface $expiration, array $options = [])
    {
        $response = $this->cosApi->getDownloadUrl(
            $this->getBucket(), $path, Carbon::now()->diffInSeconds($expiration)
        );

        $response = $this->normalizeResponse($response);

        if (false !== $response) {
            $url = parse_url($response['access_url']);

            return $this->getUrl($url['path']).'?'.$url['query'];
        }

        return $response;
    }
415639
public function get_url($forcedownload=false, $https=false) {
        if (!$this->is_readable()) {
            return null;
        }

        if ($this->is_directory()) {
            return null;
        }

        $this->urlbase;
        $contextid = $this->lf->get_contextid();
        $component = $this->lf->get_component();
        $filearea  = $this->lf->get_filearea();
        $itemid    = $this->lf->get_itemid();
        $filepath  = $this->lf->get_filepath();
        $filename  = $this->lf->get_filename();

        if ($this->itemidused) {
            $path = '/'.$contextid.'/'.$component.'/'.$filearea.'/'.$itemid.$filepath.$filename;
        } else {
            $path = '/'.$contextid.'/'.$component.'/'.$filearea.$filepath.$filename;
        }
        return file_encode_url($this->urlbase, $path, $forcedownload, $https);
    }
724155
public function to($path, $extra = [], $secure = null)
    {
        // First we will check if the URL is already a valid URL. If it is we will not
        // try to generate a new one but will simply return the URL as is, which is
        // convenient since developers do not always have to check if it's valid.
        if ($this->isValidUrl($path)) {
            return $path;
        }

        $tail = implode('/', array_map(
            'rawurlencode', (array) $this->formatParameters($extra))
        );

        // Once we have the scheme we will compile the "tail" by collapsing the values
        // into a single string delimited by slashes. This just makes it convenient
        // for passing the array of parameters to this URL as a list of segments.
        $root = $this->formatRoot($this->formatScheme($secure));

        [$path, $query] = $this->extractQueryString($path);

        return $this->format(
            $root, '/'.trim($path.'/'.$tail, '/')
        ).$query;
    }
712680
protected function generateUrl($path)
    {
        $url = $path;
        if ($this->hostPrefix) {
            // url should start with a /
            $url = $this->hostPrefix . $url;
        }

        return $url;
    }
397095
public function apiUrl(string $path = '', bool $withPropagation = true): string
    {
        $path = ($path ? '/'.ltrim($path, '/') : '');
        $resourcePath = rtrim($this->resourcePath(), '/').'/'.$this->id().$path;

        if (!$this->hasResourceOwner() || !$withPropagation) {
            return $resourcePath;
        }

        return $this->resourceOwner()->apiUrl($resourcePath);
    }
1164340
public function downloadIfRemote($file, $ext = '', $path = '', $customName = '')
    {
        $host = parse_url($file, PHP_URL_HOST);
        if ($host) {
            $file = $this->download($file, $ext, $path, $customName);
        }

        return $file;
    }
982288
public function getUrl($path)
    {
        if (! $this->host) {
            throw new BadMethodCallException("The 'host' key must be set in the b2 storage adapter to fetch URLs.");
        }

        return 'https://' . $this->host . '/file/' . $this->bucketName . '/' . $path;
    }
85399
private function getUrl($path, $parameters = [])
    {
        $url = sprintf(
            '%s/v%d/%s?client_id=%s&client_secret=%s&v=%s%s',
            $this->configuration->getBasePath(),
            urlencode($this->configuration->getVersion()),
            trim($path, '/'),
            urlencode($this->configuration->getClientId()),
            urlencode($this->configuration->getClientSecret()),
            urlencode($this->configuration->getVersionedDate()),
            $this->parseParameters($parameters)
        );

        return $url;
    }
1002241
public function createUrl($path = '', $options = array())
    {

        $builtUrl = '';
        $hasHttp = stristr($path, 'http://') || stristr($path, 'https://');

        if (!empty($options['addServer']) && !$hasHttp) {
            $builtUrl .= $this->_server;
        }

        if (!stristr($path, self::URL_PREFIX) && !$hasHttp) {
            $builtUrl .= self::URL_PREFIX . '/' . self::API_VERSION;
        }

        $builtUrl .= $path;

        if (!empty($options['addMethod']) || !empty($options['addToken'])) {
            $builtUrl .= (stristr($path, '?') ? '&' : '?');
        }

        if (!empty($options['addMethod'])) {
            $builtUrl .= '_method=' . $options['addMethod'];
        }
        if (!empty($options['addToken'])) {
            $builtUrl .= ($options['addMethod'] ? '&' : '') . 'access_token=' . $this->_auth->accessToken();
        }

        return $builtUrl;

    }
728392
public function to($path, $extra = [], $secure = null) 
  {
    $url = $baseUrl = home_url($path, $this->getSchemeForUrl($secure));

    if (!empty($extra)) {
      $url = $baseUrl . '?' . http_build_query($extra);
    }

    return $url;
  }
1050348
function host($path)
    {
        foreach ($this->files->scandir($this->sitesPath()) as $link) {
            if ($resolved = realpath($this->sitesPath().'/'.$link) === $path) {
                return $link;
            }
        }

        return basename($path);
    }
1362994
public function addBlackListEntry($host, $expire = 3600)
    {
        $rest = $this->callService('POST', self::API_DOWNLOAD_BLACKLIST,[
            'host'   => $host,
            'expire' => $expire,
        ]);

        return $rest->getModel(models\Download\BlackListEntry::class);
    }