简体   繁体   中英

React Native Download image from firebase storage to my assets folder

I know how to get the URL for the image, but I use it so often that it doesn't make sense for me to keep using uri every single time. So what I want to do is download the image into my assets folder (Override the old one) and then use that one over and over again.

here is how I get the URL

let storageRef = firebase.storage().ref('current_company_list.png');
        storageRef.getDownloadURL().then(
          function (url) {
            // image = url
          },
          function (error) {
            console.log(error);
          },
        );

but I cant seem to find how to download it to be used not as a uri anymore...

Is there any way of doing this?

The JavaScript web client APIs for Cloud Storage don't provide a way to download an object locally. If you don't want to call getDownloadURL repeatedly, then you could instead store it somewhere for reuse. It's entirely possible that future fetches of that URL coudl come from browser cache, which is effectively local storage.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM