node.jsgoogle-cloud-storagegoogle-cloud-platformgcloud-node

How to get the URL to a Google Cloud Storage file using gcloud-node?


Using the gcloud Node library, how do I get the URL for a file within a Cloud Storage bucket?

Consider the following instantation of a file object:

let bucket = gcs.bucket(`aBucket`)
let cloudFile = bucket.file(`aFile`)

I would like to get the URL for downloading cloudFile.


Solution

  • You can use a variety of request URIs, including storage.googleapis.com/<bucket>/<object>.