A lightweight library that wraps the Fetch API to return an Observable from the zen-observable package, enabling stream-based responses (e.g., OpenAI chat completions). Current stable version 1.1.2. Actively maintained with TypeScript support and a small bundle (3.7 KB min+gzip). Key differentiators: built-in OpenAI stream parsing, automatic fallback to non-streaming responses, and additive text concatenation. Ideal for real-time data consumption in frontend frameworks like React.
npm install fetch-stream-observableNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates fetching a streaming response from OpenAI's API using fetchObservable, subscribing to chunks, and unsubscribing after timeout.
Set doNotConcatTextStream: true to receive partial chunks instead.
Handle non-streaming responses in the same subscribe callback, but only expect one emission.
Convert to RxJS observable: import { from } from 'rxjs'; const rxObs = from(fetchObservable(...));Set doNotParseOpenAIStream: false (default) to enable automatic parsing of OpenAI stream deltas.
Install zen-observable explicitly: npm install zen-observable
Use named import: import { fetchObservable } from 'fetch-stream-observable'Ensure zen-observable is installed and its types are available (usually shipped with package).