1.0.0 • Published 4 years ago

callbag-from-readline v1.0.0

Weekly downloads
6
License
BSD-3-Clause
Repository
github
Last release
4 years ago

callbag-from-readline

Create a callbag from a readline interface

Install

yarn install callbag-from-readline

Usage

const { createInterface } = require('readline')
const { PassThrough } = require('stream')
const { pipe, forEach } = require('callbag-basics')
const fromReadline = require('callbag-from-readline')

const input = new PassThrough()
input.write('foo\nbar')
input.write('norf\nbaz\n')
input.write('worble\n')
input.end()

pipe(
  createInterface({ input }),
  fromReadline,
  forEach(console.log)
)
/*
foo
barnorf
baz
worble
*/

License

See LICENSE