writeToStream

Rx.Node.writeToStream(observable, stream, [encoding])

#

Writes an observable sequence to a stream.

参数

  1. observable (Obsesrvable): Observable sequence to write to a stream.
  2. stream (Stream): The stream to write to.
  3. [encoding] (String): The encoding of the item to write.

返回值

(Disposable): The subscription handle.

var Rx = require('Rx');

var source = Rx.Observable.range(0, 5);

var subscription = Rx.Node.writeToStream(source, process.stdout, 'utf8');

// => 01234