How to resume Network.request

I need to resume a network.request call that was canceled by a system event. isrror=true caused by too slow internet speed

Of course I can download the file again, but then I have to start from scratch, i.e. download the whole file again. I want to download only the missing part of the file which I failed to download completely on the first attempt.
In the documentation it says: When your application suspends…You can work around this by saving the request you wish to make to a file upon suspension. Then, on an applicationResume event, check if there is a pending request saved and, if so, execute it.

The problem is that the documentation does not show how to do it!!!

A pending request is not the same as file continuation.

You would first need to make sure you can resume a download from the server you are pulling from. This is not always a default option and requires specific headers.

Second you would most likely have to roll your own network handler as you need a way to store what you already have, and then append data properly.

I don’t believe you can specify where to continue a file download using the network built in.

-dev

1 Like