question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accessing download progress while downloading

See original GitHub issue

Hi I am trying to access the download progress while downloading a file through the code below. However it doesn’t show me the progress while downloading, it just shows it before starting (0) and after finishing (1). How can I access the progress while downloading?

  const callback = downloadProgress => {
    const progress =
      downloadProgress.totalBytesWritten /
      downloadProgress.totalBytesExpectedToWrite;
    console.log(progress);
    setProgress(progress);
  };

  const downloadFile = async (endpoint, fileName) => {
    const downloadResumable = FileSystem.createDownloadResumable(
      endpoint,
      FileSystem.documentDirectory + fileName,
      {},
      callback
    );

    try {
      const { uri } = await downloadResumable.downloadAsync();
      setLoadingState("Done");
      console.log("Finished downloading ", uri);
    } catch (e) {
      console.error(e);
    }
  };


Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mkhaledchecommented, Mar 30, 2020

Ok got it. Thanks

1reaction
IjzerenHeincommented, Mar 30, 2020

I noticed that this is not mentioned in the documentation, will add it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tracking Download Progress with ... - Medium
Accessing downloaded data​​ We'll be adding a function readDownloadedData which reads the downloaded resource as raw data and returns it. The ...
Read more >
Fetch: Download progress - The Modern JavaScript Tutorial
The fetch method allows to track download progress. Please note: there's currently no way for fetch to track upload progress.
Read more >
showing download progress while downloading a file using ...
I am developing a download manager using PHP and jquery. Requested a script that will download a file and also show the download...
Read more >
How to show the progress of a download - LiveCode Lessons
Compile the script, close the editor and change to the browse tool. Then click the button to test it.
Read more >
Download file using Javascript and show remaining time
Download file inside browser before IDM- Get remaining time in file download - Get download speed- Show progress bar with downloadSource ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found