Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Promise is resolved when network connection is discontinued and file only partially downloaded #562

@buesing

Description

@buesing

RNFB version 0.10.5
RN version 0.45.1

            RNFetchBlob.config({
              fileCache: true,
              path: getSavedPathName(session)
            })
              .fetch('GET', session.url)
              .then(resolve)
              .catch(e => {
                removeSession(session)
                reject(e)
              })

I'm using this piece of code to download video files. If the network goes down during download, the promise still resolves, and I end up with a half-downloaded file that is saved. I tested this by quickly turning off wifi during the download. In my opinion, if possible, the promise should be rejected in this case. If that is not possible, is there an easy way to check if the file download has completed? Is it possible to get the requested file size and then compare them with the file on disk once completed? Any other ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions