Is there an API to get a list of files currently uploaded to Firebase Hosting? Note that I am not talking about Firebase Storage here but Firebase Hosting.
Yes. The ListFiles endpoint will list files for a specified version. Versions can be found through the ListReleases endpoint.
Related
I would like to sync all of the files in my Google Cloud Storage bucket with the exported files in my Firebase Storage Emulator.
I downloaded all of my cloud files using gsutil to my local machine.
I used BeyondCompare to move all of the new files to the '../storage_export/blobs/ directory.
How do I update/create the JSON metadata in '../storage_export/metadata' to reflect these new files and make them available when I run the emulator and import them in?
Edit:
The gsutil docs mention the following:
when you download data from the cloud, it ends up in a file with no associated metadata, unless you have some way to keep or re-create that metadata.
How would one "keep" or "re-create" that metadata during a gsutil cp download?
You can use gsutil or the SDK to get each object's metadata and then write it down to a JSON file however, there's currently no native way to import Google Cloud Storage data in the Storage Emulator. But as I stated in my answer to this post, you can study how the emulator register the object by uploading sample files within the emulator and then running the export, you will see that the emulator will require 1 object and 1 JSON file that contains it's metadata.
Lastly, you can add the option --export-on-exit when starting the emulator, Downloaded all data from the real Firebase project, uploaded everything with the Emulator, then kill the emulator; as stated in this post.
Note: This is not a documented feature! Firebase doesn't expose the concept of download tokens in its public SDKs or APIs, so manipulating tokens this way feels a bit "hacky". For your further reference, check this post.
I am trying to set up my project in Firebase and can't seem to find an one shot way to upload my entire directory into a firebase storage bucket. Any thoughts? or is this a premium feature?
What you're calling "Firebase Storage" is actually the product Google Cloud Storage with Firebase client APIs and tools added on. You can deal with the storage bucket created by Firebase in the same way that you treat any Cloud Storage bucket. This means you can use the gsutil command line program to copy files from your machine into that bucket. This is not a premium feature.
I'm very new to using Firebase Cloud Storage. I'm currently using it to store data generated by some in-house tablet apps. We want users to be able to easily access this data in the form of Dropbox, however don't want to integrate the Dropbox API into our tablet applications as we're already using Firebase for all login management, etc and don't want users to have to login twice.
Is it possible to setup of a mirror between Firebase Cloud Storage and a Dropbox account such that any file added to Firebase Cloud Storage is immediately copied to the Dropbox directory?
You can simply use cloud functions which are being triggered by cloud storage service (it will triggered on any uploading, updating, deleting files or folders) on your firebase project and then write your cloud functions in a way to use dropbox api and then make the same change in the dropbox directory structure.
Cost and performance wise I don't think it would an efficient thing to do, unless it is what really you want.
So here is the scenario:
When I access files from Firebase Storage:
I get my file from storage bucket(.html, .png, .zip etc) (Small in size btw no more than 2mb).
Store that file in my local storage so the app don't need to download it again and consume the bandwidth of the server.
Use it from local storage everytime the app needs it.
When I access files from Firebase Hosting:
I get my file from nearest CDN of Firebase(.html, .png, .zip etc) (Small in size btw no more than 2mb).
Store that file in my local storage so the app don't need to download it again and consume the bandwidth of the server.
Use it from local storage everytime the app needs it.
NOTE: I also have one file version.txt on storage bucket (Firebase Storage). According to the value in this file, I decide whether to fetch file in Step 1 again or not. It means the version.txt is fetched everytime.
Questions:
How to achieve the similar version programming part in Firebase Hosting? I know we deploy folders, can we get their version from Firebase CDN. If yes, how?
In which method I gonna first hit my LIMIT as we know Firebase is paid after a limit.
Pros of Hosting: It will be faster. Link
PS:
1. My concern is bandwidth and not security.
Currently, I am using basic Plan (free) with limits Source:
From the Firebase docs:
The Firebase Realtime Database stores JSON application data, like
game state or chat messages, and synchronizes changes instantly
across all connected devices.
Firebase Remote Config stores
developer-specified key-value pairs to change the behavior and
appearance of your app without requiring users to download an update.
Firebase Hosting hosts the HTML, CSS, and JavaScript for your website
as well as other developer-provided assets like graphics, fonts, and
icons.
Cloud Storage stores files such as images, videos, and audio as well as other user-generated content.
Storage has higher free tier limits, while Hosting might be a little faster. Note that all files on Hosting are publicly accessible, so if you need authentication or authorization, you should use Storage.
I understand we can set Metadata for files we store in Firebase Storage.
Can we search/filter for files in Firebase Storage based on Metadata?
You can do that from Google cloud storage browser: https://console.cloud.google.com/storage/browser?project=your-firebase-project-name
There, you can search for any file name and do multiple actions on it.
Firebase SDKs now have an option to list files, though not to search them. See https://firebase.google.com/docs/storage/web/list-files
There is no way to list files, search for files or filter files within the Firebase Storage API.
There are some such features in the gcloud API, which can also be used on Firebase Storage.
You can not search with current API but if it helps you can list files https://firebase.google.com/docs/storage/web/list-files