fetch client single objec
import { decode, decodeAsync } from '@msgpack/msgpack'
const res = await fetch(url, {
method: 'POST',
headers: {
Accept: "application/json",
'Content-Type': 'application/json'
},
body: JSON.stringify({})
})
const pack = await decodeAsync(res.body)streamAsyncIterator
data = pack.dataValues
const buffer = await res.arrayBuffer()
data = decode(buffer).dataValues
fetch stream array decode
import { decodeMultiStream } from "@msgpack/msgpack"
const res = await fetch(url, {
method: 'POST',
headers: {
Accept: "application/json",
'Content-Type': 'application/json'
},
body: JSON.stringify({})
})
for await (const item of decodeMultiStream(res.body))
console.log(item)