如题
const getData = async ()=>{
const { body } = await fetch(`数据接口`, { method: 'get' })
const reader: any = body?.getReader()
const textDecoder = new TextDecoder()
while (1) {
const { done, value }: any = await reader?.read()
if (done) {
break
}
const str = textDecoder.decode(value)
console.log('str,,,,,,', str)
}
}
getData()