Closed mcharytoniuk closed 8 years ago
Maybe it would be also reasonable to add a new API method like this one?
/**
* Converts a flowing readline stream to an Observable sequence.
* @param {Stream} stream A stream to convert to a observable sequence.
* @returns {Observable} An observable sequence which fires on each 'data' event as well as handling 'error' and 'end' events.
*/
fromReadLineStream: function (stream) {
return this.fromStream(stream, 'close', 'line');
},
@mcharytoniuk yes, that would be fine
Since Node.js 0.12 we are able to use 'readline' package bundled with Node.js. It provides wrapper for
readableStream
which adds new'line'
event. It works in a similar way to the'data'
event but instead of returning buffer with bytes chunk, String of characters is returned. This pull request adds optional 'dataEventName' parameter which allows to useRxNode
with 'readline' package.See also: https://nodejs.org/api/readline.html#readline_example_read_file_stream_line_by_line