Skip to content

Conversation

JonnyBurger
Copy link
Contributor

@JonnyBurger JonnyBurger commented Aug 11, 2021

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

I am reading in a 2GB file for Remotion. This is a framework for making videos in React, and the end product is not shipped to a website, but written to an MP4 file. Therefore it's not a problem that we import these large files in Webpack.

However, when the browser is loading a video, and we seek forward, then a range header is sent to Webpack Dev Server. Unfortunately it is slow, because WDS is still loading the full file. I adapted the logic from serve-handler instead so instead of reading the full 2GB file synchronously, it uses a Read Stream.

Breaking Changes

No breaking changes.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What we need to finish?

@codecov
Copy link

codecov bot commented Aug 12, 2021

Codecov Report

Merging #1002 (75cbea1) into master (d80773b) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1002   +/-   ##
=======================================
  Coverage   97.90%   97.91%           
=======================================
  Files          10       10           
  Lines         287      288    +1     
  Branches      100      102    +2     
=======================================
+ Hits          281      282    +1     
  Misses          6        6           
Impacted Files Coverage Δ
src/middleware.js 96.15% <100.00%> (+0.15%) ⬆️
src/utils/handleRangeHeaders.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d80773b...75cbea1. Read the comment docs.

@JonnyBurger
Copy link
Contributor Author

@alexander-akait Sorry I forgot to remove the WIP notice. The PR is ready to be reviewed with no further changes intended on my side.

@alexander-akait
Copy link
Member

I adapted the logic from serve-handler instead so instead of reading the full 2GB file synchronously, it uses a Read Stream.

Can you provide link on the original code?

@JonnyBurger
Copy link
Contributor Author

Can you provide link on the original code?

It's here:
https://github.com/vercel/serve-handler/blob/c7a40435bc28b420a725e6dc1e9565d5b845dee2/src/index.js#L707-L733

@JonnyBurger
Copy link
Contributor Author

Is there anything left I can do to help this PR progress?

@alexander-akait
Copy link
Member

@JonnyBurger Sorry for delay, still in my TODO, hope I will merge it on this week

@JonnyBurger
Copy link
Contributor Author

No stress!

@alexander-akait alexander-akait mentioned this pull request Sep 7, 2021
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants