0👍
I followed this document to handle streams on the frontend:
https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Using_readable_streams
fetch('/apiURL')
.then(response=> {
const reader = reader.body.getReader()
let data = []
return reader.read().then(read = (result)=>{
if(result.done){
return data
}
data.push(result.value)
return reader.read().then(read)
})
})
.then(data => {
// Do whatever you want with your data
})
- [Vuejs]-Sending a HTTP POST REQUEST with image and text
- [Vuejs]-How do i push a variable after using split function in javascript?
Source:stackexchange.com