Copy a file on firebase storage?

前端 未结 2 782
借酒劲吻你
借酒劲吻你 2020-12-20 20:21

Is it possible to copy an existing file on firebase storage without needing to uploading it again?

I need it for a published/working version setup of my app.

2条回答
  •  轮回少年
    2020-12-20 20:52

    There is no method in the Firebase Storage API to make a copy of a file that you've already uploaded.

    But Firebase Storage is built on top of Google Cloud Storage, which means that you can use the latter's API too. It looks like gsutil cp is what you're looking for. From the docs:

    The gsutil cp command allows you to copy data between your local file system and the cloud, copy data within the cloud, and copy data between cloud storage providers.

    Keep in mind that gsutil has full access to your storage bucket. So it is meant to be run on devices you fully trust (such as a server or your own development machine).

提交回复
热议问题