Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I copy the contents of a firebase storage bucket from one project to another?

I'm using firebase storage to store profile pictures. I've created two projects: MyApp and MyApp-Dev. I can easily download the json data from the MyApp database and upload it to MyApp-Dev database. Is there a way to do something similar to transfer the images from one project to another? Without the user's profile pictures it makes testing MyApp-Dev quite difficult.

like image 896
Josh Avatar asked Jun 20 '17 04:06

Josh


People also ask

Can we download data from Firebase?

Cloud Storage for Firebase allows you to quickly and easily download files from a Cloud Storage bucket provided and managed by Firebase. Note: By default, a Cloud Storage bucket requires Firebase Authentication to perform any action on the bucket's data or files.

What is data transfer Firebase?

Data transfer (GB/month) — The amount of data transferred to end users from our CDN. Every Hosting site is automatically backed by our global CDN at no charge.


2 Answers

I did copy bucket A to be stored in the root of bucket B,

gsutil -m cp -r gs://<bucket-a>/* gs://<bucket-B>
like image 119
Katsumi Honda Avatar answered Oct 19 '22 17:10

Katsumi Honda


If you have the Google Cloud SDK installed you can use the gsutil command.

Install GCP SDK

gsutil doc

And you could move the information between buckets. Example:

gsutil -m cp -r gs://<bucket-myapp-name> gs://<bucket-myapp-dev-name>

-m to run in parallel. This can significantly improve performance if you are performing operations on a large number of files over a reasonably fast network connection

cp copy

-r recursive

like image 36
Eduardo Rosado Avatar answered Oct 19 '22 19:10

Eduardo Rosado