nodejs-storage icon indicating copy to clipboard operation
nodejs-storage copied to clipboard

Signed URL prefix

Open gabrielmcreynolds opened this issue 1 year ago • 1 comments

I would like the ability to generate a signed url that is valid for all files in a bucket with a given prefix.

There have been multiple issues requesting similar abilities, but it looks like the core ability of Google Cloud supports this. It looks the API allows creation of signed urls with a prefix. It would be nice if this functionality was built into the client library. I'm imagining something along the lines of:

  const [signedUrl] = await storage.bucket(bucketName).getSignedUrl({
    version: 'v4',
    expires: Date.now() + expirationSeconds * 1000,
    prefix: pathPrefix
  });

gabrielmcreynolds avatar May 21 '24 01:05 gabrielmcreynolds

Thanks @gabrielmcreynolds we will take a look at adding this functionality.

ddelgrosso1 avatar May 21 '24 14:05 ddelgrosso1

Hi @gabrielmcreynolds thank you for the question. Currently the Google Cloud Storage API does not support creating a signed URL based on a prefix. The documentation reference that you have provided is for the Cloud CDN which supports signed URLs based on a prefix. But for the GCS we do not support the signed URL based on a prefix.

thiyaguk09 avatar Oct 16 '24 06:10 thiyaguk09