| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #156 +/- ##
=======================================
Coverage 88.52% 88.52%
=======================================
Files 62 62
Lines 2884 2884
Branches 358 358
=======================================
Hits 2553 2553
Misses 331 331 ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This adds a check for wasm http(s) requests on the size of the download. If it exceeds 10 MB, a prompt is displayed to the user to continue or not. For example:
Note the line `Download size is 69.3 MB, continue [y/N]?
The idea is prompt the user to specifically OK a download that will consume a significant amount of browser storage. Note the filesystem usage here is 18 MB for a download of 69 MB, and we cannot advise on what the filesystem usage will be in advance.
Currently the 10 MB is hardcoded. It could be a separate env var I suppose, but we already have quite a few and should maybe avoid adding more unless we really have to. This does at least provide a starting point for future richer behaviour if we wish.
This includes a bit of a refactor of the wasm_http_response class. Now we have a single response per stream (i.e. per http(s) request) and a new read_buffer struct which is no longer part of the response but is used once per read call, which aligns better with how libgit2 behaves. This allows us to easily read the download size and headers just once, and we obtain a slight speedup for downloads with multiple reads as a result.