There is no built-in method via Firebase. However, since Firebase uses Google Cloud Storage behind the scenes for Firebase Storage it's possible to use the gutils Tool.
Prerequisites
- Make sure Python (2.7.9+) is installed on your machine
python -V
- Go to the Google Cloud SDK page and follow the directions to download and install Google Cloud SKD on your OS.
Steps
- At the end of the Google SDK installation you should have run
gcloud init
. This will ask you to select your project and authenticate you. Since Firebase uses Google Cloud Platform behind the scenes your Firebase project should be available as a choice. - In order for Google Cloud Utils to download the files that were uploaded with Firebase permissions you need to give your account Firebase Privileges. Go to the IAM page and select your email address you signed into
cloud init
with. In the list of available permissions you need to selectFirebase Rules System
from theOther
category. - Get your Google Storage URL from the Firebase Storage Page in the dashboard (Towards the top) Should look something like this:
gs://<bucket_name>
- In command line on your local machine navigate to the folder you want to do a local backup to. Make sure you are in the folder you want as the following command will download all files right there in current folder.
- Run the gutil command
gsutil -m cp -R gs://<bucket_name> .
m
enables multithreading for faster downloads if you have many files.cp
is the copy commandR
is recursive. If enabled it will download all files and folders in the specified tree.
- You're done! This will run for some time depending on the size of your storage.
This can be used to also make a copy(backup) to another Google Cloud Storage Bucket or AWS etc.