Skip to content

Conversation

@sitatec
Copy link

@sitatec sitatec commented Mar 29, 2025

Currently, if you try to stream files you get a FileOutput instance in the following state:

FileOutput {
  locked: false,
  [state]: 'errored',
  [supportsBYOB]: false,
  [length]: undefined
}

This is because a { data, fetch } object is passed to createFileOutput, which expects a { url, fetch } object.

I also noticed that FileOutput is always used for streaming, so I added the useFileOutput option to the *stream function and set the value of Replicate.useFileOutput as default.

Copy link

@u6516024155-coder u6516024155-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patrycja

Copy link

@u6516024155-coder u6516024155-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super aplikacja😘

@rovo89
Copy link

rovo89 commented Nov 4, 2025

I have just spend at least two hours trying to find out what I'm doing wrong, trying to write the output to a file. Besides the fact that ServerSentEvent.data is a string and needs to be converted to a ReadableStream or FileOutput first, the crucial point was the wrong call of createFileOutput() that is fixed with this PR.

@zeke Could you merge at least this part of the suggested change? Not sure about the other half and the types, but for the wrong call there is no workaround. Thanks!

@zeke zeke requested a review from aron November 4, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants