
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
event-stream-parser
Advanced tools
Server-Sent Events (SSE) Parser / Event Stream Parser implementation following HTML Standard
A lightweight Server-Sent Events (SSE) parser implementation following the HTML Living Standard specification. This package is designed to work with the Web Streams API and is fully compatible with modern browsers and Node.js.
npm install event-stream-parser
# or
yarn add event-stream-parser
# or
pnpm add event-stream-parser
You can import the package in two ways:
// Using v1 explicitly
import { parse } from 'event-stream-parser/v1';
// Using default import (same as v1)
import { parse } from 'event-stream-parser';
// Example with fetch
const response = await fetch('https://api.example.com/events', {
headers: {
Accept: 'text/event-stream',
},
});
if (!response.body) {
throw new Error('Response body is null');
}
const eventStream = await parse(response.body);
eventStream.pipeTo(
new WritableStream({
write(event) {
console.log('Event type:', event.type);
console.log('Event data:', event.data);
console.log('Last event ID:', event.lastEventId);
},
})
);
Parses a readable stream of SSE data and returns a readable stream of MessageEvent
objects.
stream
: A ReadableStream<Uint8Array>
containing the SSE dataPromise<ReadableStream<MessageEvent>>
that yields parsed SSE eventsMIT
Contributions are welcome! Please feel free to submit a Pull Request.
FAQs
Server-Sent Events (SSE) Parser / Event Stream Parser implementation following HTML Standard
The npm package event-stream-parser receives a total of 754 weekly downloads. As such, event-stream-parser popularity was classified as not popular.
We found that event-stream-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.