项目作者: jliuhtonen

项目描述 :
Convert between Bacon.js event streams and Node.js readable streams
高级语言: TypeScript
项目地址: git://github.com/jliuhtonen/bacon-node-stream.git
创建时间: 2017-09-13T16:50:49Z
项目社区:https://github.com/jliuhtonen/bacon-node-stream

开源协议:MIT License

下载


bacon-node-stream

Utility for creating Node.js readable streams from Bacon streams and vice versa.

Usage

Install this package and baconjs, that is this package’s peer dependency.

API

  1. readableToBacon(stream: Readable, options?: ReadableOptions): Bacon.EventStream<any, any>

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()).

  1. baconToReadable(stream: Bacon.EventStream<any, any>, 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.