[英]How to create signed Google Cloud Storage URLs in Cloud Function using Cloud Function service account?
[英]How to download a file using the signed URL of google cloud storage in angular
您可以将GetSignedUrlConfig
中的responseDisposition
属性设置为attachment
,如下所示:
const [url] = await storage
.bucket("[bucket]")
.file("[path]")
.getSignedUrl({
version: "v4",
action: "read",
responseDisposition: "attachment",
// optionally specify file name
// responseDisposition: "attachment; filename=name.ext",
expires: Date.now() + 15 * 60 * 1000,
});
return url;
然后在获得签名的 URL 后重定向到 URL,如下所示:
window.open(this.downloadUrl, '_blank').focus();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.