Skip to content

Stream reading a Response object may not be available while a progress callback is specified#1281

Closed
Xmader wants to merge 1 commit intohuggingface:mainfrom
Xmader:patch-1
Closed

Stream reading a Response object may not be available while a progress callback is specified#1281
Xmader wants to merge 1 commit intohuggingface:mainfrom
Xmader:patch-1

Conversation

@Xmader
Copy link
Copy Markdown

@Xmader Xmader commented Apr 11, 2025

The body property may not be available on a Response object to do streaming, e.g., when using a fetch polyfill.

@xenova
Copy link
Copy Markdown
Collaborator

xenova commented Apr 14, 2025

Thanks for the PR! Very interesting. 👀 Do you have a link to some documentation which states that the response body may be undefined in that (or some other) polyfill?

@Xmader
Copy link
Copy Markdown
Author

Xmader commented Apr 15, 2025

Hi @xenova, Thanks for the reply!
I couldn't find anywhere in the documentation of that polyfill, but I found a few issues (JakeChampion/fetch#1454, JakeChampion/fetch#746, JakeChampion/fetch#198 (comment)) saying Response.body is undefined and would unlikely be supported ever.


Another polyfill https://github.com/developit/unfetch says it only supports a subset of the Response class, response.body is not included.

@xenova
Copy link
Copy Markdown
Collaborator

xenova commented Apr 15, 2025

Thanks for the info 👍 And just for interest's sake, what environment are you running in that requires a fetch polyfill?

@lindboe
Copy link
Copy Markdown

lindboe commented Dec 19, 2025

And just for interest's sake, what environment are you running in that requires a fetch polyfill?

@xenova Most React Native apps use a fetch polyfill. (Some use expo/fetch which is a native module implementation.)

I am not using this library, just came across this while researching some changes to the fetch polyfill, so I figured I would answer.

@xenova
Copy link
Copy Markdown
Collaborator

xenova commented Mar 18, 2026

As of Transformers.js v4, we expose a custom env.fetch option, which you can use if you need to support this.

@xenova xenova closed this Mar 18, 2026
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