Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jliuhtonen/bacon-node-stream
Convert between Bacon.js event streams and Node.js readable streams
https://github.com/jliuhtonen/bacon-node-stream
baconjs frp node-streams nodejs
Last synced: 24 days ago
JSON representation
Convert between Bacon.js event streams and Node.js readable streams
- Host: GitHub
- URL: https://github.com/jliuhtonen/bacon-node-stream
- Owner: jliuhtonen
- License: mit
- Created: 2017-09-13T16:50:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-20T07:00:51.000Z (over 7 years ago)
- Last Synced: 2024-10-29T21:22:27.999Z (2 months ago)
- Topics: baconjs, frp, node-streams, nodejs
- Language: TypeScript
- Size: 22.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bacon-node-stream
Utility for creating [Node.js readable streams](https://nodejs.org/api/stream.html#stream_readable_streams) from [Bacon streams](http://baconjs.github.io/) and vice versa.
## Usage
Install this package and `baconjs`, that is this package's peer dependency.
### API
```typescript
readableToBacon(stream: Readable, options?: ReadableOptions): Bacon.EventStream
```Creates a new Node.js stream that is exposed as a Bacon event stream and pipes `stream` into it. Use this function for creating a Bacon EventStream from a Readable stream. You must provide the options accordingly, so if `stream` uses object mode, you must also specify it here, and so on.
Note to TypeScript users: `Readable`'s values are not typed, so you must cast or determine the correct type yourself (use `.map()`).
```typescript
baconToReadable(stream: Bacon.EventStream, options?: ReadableOptions): Readable {
```Wraps a Bacon event stream as a Node.js Readable stream. If the Readable is paused _all values, errors and the possible end event of the stream are buffered until the Readable is resumed_. Remember to provide options if your stream uses the object mode.