react-stream-event-any
v0.0.22
Published
Streaming event for any api methods.
Downloads
18
Readme
React stream event any
Get started
bun a react-stream-event-any
npm i react-stream-event-any
yarn add react-stream-event-any
pnpm add react-stream-event-any
Usage
import ServerStreamEvent from "react-stream-event-any"
type StreamData = string
const response = ServerStreamEvent<StreamData>({
url: `${ApiEndpoint}/ai/chat/completions/${id}`,
method: "POST",
header: {
"Content-Type": "application/json"
},
body: JSON.stringify(data)
})
for await (const data of response){
console.log(data) // type StreamData
}