0.1.8 • Published 1 year ago

stream-fetch-processor v0.1.8

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

stream-fetch-processor

SSE - A Stream Fetch Processor for client

Usage

# using yarn
yarn add stream-fetch-processor
import StreamFetchProcessor from 'StreamFetchProcessor';
const payload = {
  // ...
};
const sfp = new StreamFetchProcessor();

const response = await sfp.fetch(`url`, {
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${API_KEY}`,
    Origin: '*',
  },
  method: 'POST',
  body: JSON.stringify(payload),
});

if (response.ok) {
  const result = sfp.read();
  for await (const data of await result) {
    const data = JSON.parse(data);
    console.log(data);
  }
}
0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.0

1 year ago

0.0.1

1 year ago