Open brettwillis opened 4 months ago
Hey guys it's been a while and no triage. Are "byob" streams intentionally not implemented?
// test.js
Bun.serve({
host: 'localhost',
port: '8080',
async fetch(req) {
const reader = await req.body?.getReader({ mode: 'byob' });
return new Response('done');
}
});
Then curl http://localhost:8080 -d 'Hello'
.
1 | Bun.serve({
2 | host: 'localhost',
3 | port: '8080',
4 | async fetch(req) {
5 | const reader = await req.body?.getReader({ mode: 'byob' });
^
TypeError: ReadableStreamBYOBReader needs a ReadableByteStreamController
at /Users/..../test.js:5:36
at fetch (/Users/..../test.js:4:15)
POST - / failed
Docs claim that ReadableStream
is fully implemented https://bun.sh/docs/runtime/nodejs-apis#readablestream. Am I the only one encountering this?
i just hit this in the safari browser while working on #15181, which is funny that the top google search for that message is an issue in bun. the bug seems to be something in BYOB streams, since the code sample i had (using streaming fetch
in the browser) worked in chrome/v8. adding the jsc
tag here.
Docs claim that
ReadableStream
is fully implemented https://bun.sh/docs/runtime/nodejs-apis#readablestream. Am I the only one encountering this?
I'm not using them directly, but rather through the fileTypeFromStream
method on the file-type
package. Regardless, I'm also using Bun, and I believe I have the same problem.
What version of Bun is running?
1.1.21+70ca2b76c
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
Send request with body to the Bun server,
request.body.getReader()
throws when trying to obtain aReadableStreamBYOBReader
.What is the expected behavior?
ReadableStream should support byob mode.
What do you see instead?
TypeError: ReadableStreamBYOBReader needs a ReadableByteStreamController
Additional information
No response