简体   繁体   English

如何上传到谷歌云存储

[英]How to upload to Google Cloud Storage

  1. How do I upload to a Google Cloud Storage bucket, not the Firebase Storage?如何上传到 Google Cloud Storage 存储桶,而不是 Firebase 存储? According to this documentation , the way you get a reference to the Firebase storage and Cloud storage seem to be exactly the same.根据此 文档,您获取 Firebase 存储和云存储的引用方式似乎完全相同。 But, when I try to access the bucket from Cloud Function, I am given two choices ( gcf-sources-234340858426-us-central1 and us.artifacts.233093489-23.appspot.com ) that are completely different from the Firebase Storage ( gs://someaddress.appspot.com ). But, when I try to access the bucket from Cloud Function, I am given two choices ( gcf-sources-234340858426-us-central1 and us.artifacts.233093489-23.appspot.com ) that are completely different from the Firebase Storage ( gs://someaddress.appspot.com )。 I'm currently able to upload to Firebase storage with the Firebase SDK from the front end.我目前能够从前端使用 Firebase SDK 上传到 Firebase 存储。

  2. Can Firebase Storage trigger Google Cloud Function with event triggers? Firebase 存储是否可以通过事件触发器触发 Google Cloud Function?

Uploading Files上传文件

Cloud Storage buckets and Firebase buckets are the same thing under the hood. Cloud Storage 存储桶和 Firebase 存储桶在底层是一样的。 That said, if you want to use the Google Cloud-specific (ie non-Firebase) approach, you can use the client libraries or the REST API .也就是说,如果您想使用 Google Cloud 特定(即非 Firebase)方法,您可以使用客户端库REST API

Triggering functions触发函数

Yes - you should be able to trigger a Storage-triggered function by uploading files to a bucket.是的 - 您应该能够通过将文件上传到存储桶来触发存储触发的 function The deployment command might look something like this:部署命令可能如下所示:

# Note: this is untested, and assumes you have the Google Cloud SDK installed
gcloud functions deploy my-function --trigger-bucket "someaddress.appspot.com"

Hope this helps!希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM