具有写入权限和预定义元数据的 GCP 存储 file.getSignedUrl

问题描述

我想让客户端应用上传具有特定名称、元数据和大小的文件。看起来我可以在服务器端预定义文件名,但我无法控制元数据。有没有办法实现这个逻辑?

getSignedUrl() API

解决方法

其中一些用例可以使用策略文档来解决:

https://cloud.google.com/storage/docs/authentication/signatures#policy-document

在节点中,API 是 getSignedPolicy

https://googleapis.dev/nodejs/storage/latest/File.html#getSignedPolicy