react-stream-event-any

0.0.22 • Public • Published

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
}

Readme

Keywords

none

Package Sidebar

Install

npm i react-stream-event-any

Weekly Downloads

1

Version

0.0.22

License

none

Unpacked Size

20.6 kB

Total Files

10

Last publish

Collaborators

  • hvuad