Monday, June 26, 2023

Firebase hosting how to restore the file from cloud if they are lost from the local machine

Did a lot of search on this but finally got this and it works perfectly!! 

You should of course add your own version control (e.g. git) to manage your revisions and backups so this doesn't occur.

There is a script you can run to download all the assets using the CLI. You can find the script and instructions here. It can also be run using npx:

npx https://gist.github.com/mbleigh/9c8680cf319ace2f506f57380da66e7d <site_name>

Note that this only returns the compiled/rendered content from the specified public folder and not any precompiled source you may have had on the development machine.

Since your files are static assets, you could also scrape them using wget. This is inferior for advanced apps as you'll get the rendered content and not the source:

wget -r -np https://<YOURAPPNAME>.firebaseapp.com

Read more on scraping web sites here: https://apple.stackexchange.com/questions/100570/getting-files-all-at-once-from-a-web-page-using-curl

references:

https://stackoverflow.com/questions/26286339/pull-lost-code-from-firebase-hosting-deployment


No comments:

Post a Comment