Это видео недоступно.
Сожалеем об этом.

Download Progress Bar in React with Fetch API

Поделиться
HTML-код
  • Опубликовано: 30 авг 2023
  • Build a progress bar for downloads using the Fetch API and Streams in React.
    We'll walk through downloading a file programmatically to the visitors filesystem, streaming the file download using the Fetch API, inspecting the amount of data received to the browser in chunks, and learning how to throttle state updates for improved performance in React.
    📺 RUclips: ruclips.net/user/co...
    🐦 Twitter: / colbyfayock
    📹 Twitch: / colbyfayock
    ✉️ Newsletter: www.colbyfayoc...
    🎥 What I Use: www.colbyfayoc...
    #colbyfayock #reactjs #webdevelopment

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

  • @colbyfayock
    @colbyfayock  14 дней назад

    Learn how to build a full stack Next.js app in my upcoming course: colbyfayock.com/course

  • @alokbaluni8760
    @alokbaluni8760 Месяц назад

    Dude you're the GOAT. You're my new favourite RUclipsr!

  • @guillermo.avalos
    @guillermo.avalos 11 месяцев назад

    Awesome, such a simple and elegant approach.

  • @noeldolan518
    @noeldolan518 Месяц назад

    Possibly a silly question, but by the time the 'const response = await fetch(...)' request has completed, isn't the file already downloaded on the client side? (so the 'progress' bar is only related to writing the file from local browser memory to the local file system?)

    • @colbyfayock
      @colbyfayock  Месяц назад +1

      the progress would be from writing from network to local browser memory, then that result is downloaded from memory

  • @sincethatmoment
    @sincethatmoment 8 месяцев назад

    Your videos are such a treat. Amazing

  • @raphauy
    @raphauy 11 месяцев назад +1

    Very useful. Thanks for sharing!

  • @CYJOHN1120
    @CYJOHN1120 Месяц назад

    Followed along the video and am getting cors error while fetching a image, any idea on how do we fix it?

    • @colbyfayock
      @colbyfayock  Месяц назад

      the image request itself is getting a CORS error? dont usually hear about CORS issues related to images. i would expect that to be a configuration issue or they're intentionally blocking the image from being requested from another source. hard to know for sure without understanding more about how the image is being delivered

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

    this is why I sometimes use axios still, getting progress is so much more simple

  • @kacpersionkowski873
    @kacpersionkowski873 8 месяцев назад

    Amazing tutorial, thank you :)

  • @user-te4gn9yq5c
    @user-te4gn9yq5c 4 месяца назад

    great idea , but there is the problem of downloading it twice , both fetch and a.click?

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

      the download from the remote server only happens once, after the fetch its stored in the browser, which will then save it to the filesystem

    • @user-te4gn9yq5c
      @user-te4gn9yq5c 4 месяца назад

      that's sound awesome , this is the solution i'm looking for , thanks a lot man @@colbyfayock

  • @juhandvan
    @juhandvan 11 месяцев назад

    Can you share me the source code ? Thank you so much

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

      i accidentally deleted it locally 😭 but ive been meaning to write a supplemental article for this video, i just haven't got to it yet. will publish it at spacejelly.dev at some point hopefully soon

  • @Abdullahsiddique-wf2nt
    @Abdullahsiddique-wf2nt 6 месяцев назад

    Code

    • @colbyfayock
      @colbyfayock  6 месяцев назад

      don't have this one in a repo right now