Coder Social home page Coder Social logo

Comments (7)

wkh237 avatar wkh237 commented on July 17, 2024

Hi @vaibhawc , thank you for your information! Looks like the progress report mechanism is broken since I change the HTTP implementation. I'll fix this issue.

from react-native-fetch-blob.

wkh237 avatar wkh237 commented on July 17, 2024

@vaibhawc , thank you for your assistance, this issue has been solved in 1b2d9a7 and will be included in next release 0.6.1, I'll publish this version after doing some more tests on Android.

from react-native-fetch-blob.

vaibhawc avatar vaibhawc commented on July 17, 2024

Thank you @wkh237 , that was very quick and sincere. I am actually trying to send an image where I need to know progress as well handle cancel and resume. I haven't tried it yet, but will have to handle it by my own. It might be a good idea to consider such options like onCancel, onResume. Basically they are inspired by the firebase-storage-api. Or may be I should put it on separate thread.

from react-native-fetch-blob.

wkh237 avatar wkh237 commented on July 17, 2024

Hi @vaibhawc , thank you for your suggestion and feedback, I've published a new version 0.6.1 on npm, please re-install the package and see if that fulfills your use case. You're welcome to leave a comment here if there's any question : ) As for the onResume and onCancel options, I think those are very important features that I'm considering to add them into this module 👍

from react-native-fetch-blob.

vaibhawc avatar vaibhawc commented on July 17, 2024

Hi @wkh237 ,It works well, thank you. RNFB is an amazing problem solver for me.
But there are so many functionalities not provided in RN that might be provided by libraries like this in future. One such functionality, which I don't require, but found out while trying firebase-storage, is that FBStorage requires blob to be passed to its API's 'put()' method which essentially means I can't use RN anyhow (afaik) for FBStorage. https://firebase.google.com/docs/reference/js/firebase.storage.Reference#put
May be somebody might require it, or may be firebase may provide some alternative to it in future.
As of now, I don't have enough know-how to make one all myself or on top of RNFB (I'd love to).
If you find time, do try it out. :)
I am closing this one here, Thank you for your support. 👍

from react-native-fetch-blob.

wkh237 avatar wkh237 commented on July 17, 2024

@vaibhawc , I'm greatly appreciate your thoughtful comments that helped improve the module. Thought we can not use FireBase web SDK directly, I suppose it is possible to use its REST API alternatively. I'm not familiar with FireBase, but I'll take some time and give it a try. 👍

from react-native-fetch-blob.

Johncy1997 avatar Johncy1997 commented on July 17, 2024
RNFetchBlob.config({
            path:`${dirs.DownloadDir}/${filename}`,
            fileCache:false
            // addAndroidDownloads: {
            //     notification : true,
            //     useDownloadManager : true,
            //     description: 'TaxiJo Payment Invoice',
            //     mime:'application/pdf',
            //     mediaScannable:true,
            //     path:`${dirs.DownloadDir}/${filename}`
            // },
        })
        .fetch('GET',this.state.invoiceUrl,{
            'Cache-Control' : 'no-store'
        })
        .progress({ interval: 250 },(received,total)=>{
            console.log('progress',received/total);
            this.setState({
                downloadProgress:(received/total)*100
            })
        })
        .then(res=>{
            // RNFetchBlob.fs.stat(res.path()).then(stats=>{
            //     console.log(stats);
            // }).catch(err=>{
            //     console.log('error while getting mimetypes');
            // })
            this.setState({
                downloadProgress:0
            })
            // RNFetchBlob.fs.exists(res.path()).then(exist=>{
            //     console.log(`file ${exist ? '' : 'not'} exists`)
            // }).catch(
            //     err=>console.log('error while checking existance',err)
            // );
            if(Platform.OS === 'ios'){
                RNFetchBlob.ios.openDocument(res.path());
            }else{
                RNFetchBlob.android.actionViewIntent(res.path(),"application/pdf");
            }
        })
        .catch((errorMessage,statusCode)=>{
            console.log("error with downloading file",errorMessage)
        })

from react-native-fetch-blob.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.