Generating signed URL for a file download

This lesson describes how to generate a signed URL for a file download

Code: /lessons/Generating_signed_URL_for_a_file_download

In this example, the function code accepts the bucketName and the sourceFilePath as input parameters. It fetches the signed URL link which can be used to download the file.

Prerequisite

The same file as the one used in the previous example .

Steps

  1. Create a new function called GeneratingSignedUrl.java.

  2. Upload a file to the GCS bucket.

  3. Set passed parameters as the name of the bucket and file path.

  4. Call StorageApi.getSignedUrl function with the above parameters.

  5. Return the signed URL response in the form of a Result.

Last updated