Open
Description
Hey,
in short: I have a problem with handling progress in toBlobURL
method, when downloading a compressed wasm module.
Some observations:
- if we pass a progress block, the
downloadWithProgress
implementation is used under-the-hood, - the display of the progress block is based on the
Content-Length
header - the
Content-Length
header is related toContent-Encoding
(which is controlled by the client, e.g.:Accept-Encoding: gzip, deflate, br, zstd
) - the
fetch
method downloads the compressed module, but returns the uncompressed one,
This causes this exception to occur in this downloadWithProgress
method:
if (total != -1 && total !== received)
throw ERROR_INCOMPLETED_DOWNLOAD;
Then in the catch
block, we call buf = await resp.arrayBuffer()
, and this causes a second exception on the already downloaded file:
ffmpegwasm Failed to execute 'arrayBuffer' on 'Response': body stream already read…
Which effectively makes it impossible to download this wasm module.
Wasm files compress very well, for example, the ffmpeg-core.wasm
module compresses from ~30MB to ~7MB using brotli.
Personally, I don't know how to fix this properly, that the downloadWithProgress
method handles compressed files.
Metadata
Metadata
Assignees
Labels
No labels