Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Extend support for useFileOutput to stream #309

Merged
merged 5 commits into from
Sep 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ function createReadableStream({ url, fetch, options = {} }) {
.pipeThrough(new EventSourceParserStream());

for await (const event of streamAsyncIterator(stream)) {
if (event.event === "done") {
break;
}

if (event.event === "error") {
controller.error(new Error(event.data));
break;
Expand All @@ -87,10 +91,6 @@ function createReadableStream({ url, fetch, options = {} }) {
controller.enqueue(
new ServerSentEvent(event.event, event.data, event.id)
);

if (event.event === "done") {
break;
}
}

controller.close();
Expand Down