Stream api support within a react-native project
See original GitHub issueDescribe the issue Does axios support Stream api(https://jakearchibald.com/2016/streams-ftw/#creating-your-own-readable-stream) and that too within a react-native project.
Example Code fetch support Stream within browser, and as axios is written over fetch hopefully it should also support Stream. Code with fetch is mentioned below
fetch('https://html.spec.whatwg.org/').then(function(response) {
var reader = response.body.getReader();
var bytesReceived = 0;
reader.read().then(function processResult(result) {
if (result.done) {
console.log("Fetch complete");
return;
}
bytesReceived += result.value.length;
console.log(`Received ${bytesReceived} bytes of data so far`);
return reader.read().then(processResult);
});
});
Expected behavior, if applicable So I am expecting that axios will behave same as fetch on browser but will it work within a react-native project, because implementation of fetch is slightly different on web than within react-native environment and so may be implementation of axios(https://stackoverflow.com/questions/56207968/stream-api-with-fetch-in-a-react-native-app),
Additional context/Screenshots It is not a bug and that too not for axios for sure. I am just expecting suggestions if someone have implemented this kind of functionality or is it possible with axios.
Thanks
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top GitHub Comments
Same issue here. I tested the following code using Jest and the function worked as intended.
However, when we put it into the React Native application, we received the error:
Closed see #479