https://github.com/afeiship/sse-parser
Event source message parser.
https://github.com/afeiship/sse-parser
event-source json parse parser prefixed-json sse
Last synced: about 2 months ago
JSON representation
Event source message parser.
- Host: GitHub
- URL: https://github.com/afeiship/sse-parser
- Owner: afeiship
- License: mit
- Created: 2018-03-03T08:07:11.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2024-06-30T03:39:57.000Z (almost 2 years ago)
- Last Synced: 2025-02-07T10:45:28.694Z (over 1 year ago)
- Topics: event-source, json, parse, parser, prefixed-json, sse
- Language: TypeScript
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# sse-parser
> Event source message parser.
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]
## installation
```shell
npm install @jswork/sse-parser
```
## usage
```js
import SseParser from '@jswork/sse-parser';
// parse multi lines
SseParser.parse('event: message\ndata: hello\n\n');
// [{ event:'message', data: 'hello' }]
```
## license
Code released under [the MIT license](https://github.com/afeiship/sse-parser/blob/master/LICENSE.txt).
[version-image]: https://img.shields.io/npm/v/@jswork/sse-parser
[version-url]: https://npmjs.org/package/@jswork/sse-parser
[license-image]: https://img.shields.io/npm/l/@jswork/sse-parser
[license-url]: https://github.com/afeiship/sse-parser/blob/master/LICENSE.txt
[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/sse-parser
[size-url]: https://github.com/afeiship/sse-parser/blob/master/dist/index.min.js
[download-image]: https://img.shields.io/npm/dm/@jswork/sse-parser
[download-url]: https://www.npmjs.com/package/@jswork/sse-parser