-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
Due to the current implementation, the frontend must download the entire file, which in turn prevents buffering ("the frontend has to download the whole file first") in the video / audio control:
Line 160 in 4032231
| new Response(Bun.file(file), { |
Bun supports Streaming files:
You can send part of a file using the
slice(start, end)method on theBun.fileobject. This automatically sets theContent-RangeandContent-Lengthheaders on the Response object.
However this behavior doesn't allow seeking ("jumping to a timestamp") because the actual size is not set in the Content-Range header:
- Bun:
bytes 0-10/* - Required:
bytes 0-10/20
manually setting the header works but it ends up twice in the response (with
[email protected]- due toslice(start, end))new Response(Bun.file(filename).slice(start, end), { status: 206, headers: { 'Content-Range': `bytes ${start}-${end - 1}/${size}` } });
Metadata
Metadata
Assignees
Labels
No labels