Track Fetch Request Download Progress + Progress Bar | JavaScript Tutorial

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 21

  • @OpenJavaScript
    @OpenJavaScript  Год назад +2

    Source code: openjavascript.info/2022/12/21/download-progress-with-javascripts-fetch-function/
    For upload progress, this isn't yet possible with fetch, but you can get it with:
    XMLHttpRequest (native solution): ruclips.net/video/9biknk9SecY/видео.html
    Axios: ruclips.net/video/nC3ntJUQrAM/видео.html

  • @jame_sta
    @jame_sta Год назад +2

    Thank you very much! Not many tutorials about this on the web using real data.

  • @viniciusm.m.7822
    @viniciusm.m.7822 Год назад +4

    Wow. Maybe i can understand all these JS code until next year haha
    Thanks, bro!
    Abraço!

    • @OpenJavaScript
      @OpenJavaScript  Год назад +2

      Yeah, this is a bit more complicated than with Axios. But it doesn't get any easier with Fetch and at least you get to become more familiar with streams :)

  • @longsuabc
    @longsuabc Год назад +2

    Wow, very useful, understandable and easy.!!!
    You're super!
    Thank you for sharing.

  • @richardfigueroa611
    @richardfigueroa611 2 месяца назад

    This could be done when obtaining data from the DB, monitoring approximately how long the request will take or it only works with files.

  • @BrightAnyawe
    @BrightAnyawe 3 месяца назад

    Bro, why use the spread operator on the response => header?

  • @bialykostek
    @bialykostek 4 месяца назад

    Thanks man

  • @lacvietanh
    @lacvietanh Год назад +1

    wowww thank you so much!

    • @OpenJavaScript
      @OpenJavaScript  Год назад

      You're welcome. The solution is a bit long-winded but works for now until there is some sort of native onProgress function added to Fetch.

  • @coffeeandtalk
    @coffeeandtalk 10 месяцев назад

    that's why i'm grateful for axios

  • @davidreyna7695
    @davidreyna7695 Год назад +1

    Very good content

  • @jacoblindegren2085
    @jacoblindegren2085 Год назад +2

    Question, so this is reading back the content that we are receiving from the url. What if we want to read the content being sent to a url? For instance I am sending files to a server, which is then doing some work to create thumbnails of the images and save them to an S3 bucket on AWS. Is it possible to read that progress in the body of the fetch? Or shall I stick to an XMLHttpRequest?

    • @OpenJavaScript
      @OpenJavaScript  Год назад +1

      Hi Jacob great question. It's something I've often wondered about and looked into numerous times.
      Unfortunately my understanding is that at the current time it isn't possible to track upload progress with fetch.
      The options (for now) are basically XMLHttpRequest or using a library like Axios that uses it under the hood.
      I do plan on a fetch upload progress tutorial as soon as it become available. I'll try to remember to post here again when that day arrives.

    • @oghenekarouzezi4504
      @oghenekarouzezi4504 Год назад

      @@OpenJavaScript Even though I am yet to implement it or try it... I saw somewhere on mozilla, when I was learning about streams, that you can create a Request with some ReadableStream, which is then use to track the data sent...

  • @LoneWolfCodingProfessional
    @LoneWolfCodingProfessional Год назад +1

    axios first with async await

    • @OpenJavaScript
      @OpenJavaScript  Год назад

      Already have a tutorial on download progress with a bar using Axios: ruclips.net/video/QabJ7e7ku58/видео.html
      For async/await, you may want to check out my more general tutorial on that: ruclips.net/video/7l2-ds_U2Lc/видео.html
      Or, maybe even this one on using Fetch with async/await since the syntax is so similar so can be easily adapted for Axios: ruclips.net/video/8JcCdp2Y4Q4/видео.html

  • @JasonJA88
    @JasonJA88 Год назад +2

    Upload progress is a pain...

    • @OpenJavaScript
      @OpenJavaScript  Год назад +1

      Unfortunately, at the current time Fetch does not support upload progress.
      Until, then you're better off using ajax for a native solution (ruclips.net/video/9biknk9SecY/видео.html) or axios (ruclips.net/video/nC3ntJUQrAM/видео.html)