oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.5k stars 2.71k forks source link

Didn't support TextDecoderStream #10163

Closed grapewheel closed 5 months ago

grapewheel commented 5 months ago

What version of Bun is running?

1.1.3+2615dc742

What platform is your computer?

Linux 6.6.25-1-lts x86_64 unknown (archlinux)

What steps can reproduce the bug?

While I used the module modelfusion 's streamText function

import { streamText } from 'modelfusion'

const textStream = await streamText({
  model,
  prompt,
})

The streamText function use the TextDecoderStream which includes in the Node >= 16.6, MDN DOC, but the bunjs runs in error below:

// src/util/streaming/parseEventSourceStream.ts
async function parseEventSourceStream({
  stream
}) {
const eventStream = stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream());

ReferenceError: Can't find variable: TextDecoderStream

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

Jarred-Sumner commented 5 months ago

Duplicate of #5648