Convert an input stream to observable of lines
We have the following script:
// script.js
const { getLinesFromStream } = require('line-observable-rxjs')
getLinesFromStream(process.stdin).subscribe({
next: line => console.log('line>', line.trim()),
complete: () => console.log('done.')
})
Run the script:
printf 'abc\ndef\nghi' | node script.js
Expected Output:
line> abc
line> def
line> ghi
done.
Generated using TypeDoc