GitLiveApp / firebase-kotlin-sdk

A Kotlin-first SDK for Firebase
https://gitliveapp.github.io/firebase-kotlin-sdk/
Apache License 2.0
979 stars 148 forks source link

How to download files using storage? #530

Open SirFilbido opened 2 weeks ago

SirFilbido commented 2 weeks ago

I have implemented the storage library but I am having difficulty downloading files.

In my case, I have to download .zip files in the commonMain package.

Does the SDK currently have this type of implementation? If not, would I have to implement it on the native side to then use it in the shared environment?

BasBuijsen commented 2 weeks ago

Im not a maintainer or anything but i have been working on some storage improvements. There is currently no implementation for this.

You can add the functionality by updating the expected class in commonMain and then you can use the native SDKs to provide the actual implementations.

I don't know what kind of files you want to download but you can also access the download url of a reference. That way you can use your http client to download these files as long as this functionality is not available yet.

SirFilbido commented 2 weeks ago

Thanks for the tips @BasBuijsen , I'll try to implement the download via the file's URL. In my case, they are .zip files

But I'm having another problem and I don't know if the SDK supports this. I have some different databases in the storage. I need to configure the address that is not in the google-services.json file.

On Android I can do it like this

val storage = Firebase.storage(BuildConfig.BUCKET_SINC)

How would I do this in Firebase SDK?

BasBuijsen commented 2 weeks ago

@SirFilbido as far as i can see there is no support for this yet.

BasBuijsen commented 1 week ago

@SirFilbido i had some time to spare so i created the getters for Firebase storage with a custom url.