0.0.4 • Published 5 months ago
fetch-sse-stream v0.0.4
fetch-sse-stream
A library for Server-Sent Events, like fetch.
Usage
import { fetchSseJsonStream } from 'fetch-sse-stream';
fetchSseJsonStream('https://api.openai.com/...', {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
},
body: {
stream: true,
// ...
},
onData(data) {
console.log(data);
},
});