terminal-duplex
v2.0.7
Published
terminal console that can handle input & output at the same time
Maintainers
Readme
terminal-duplex
const Terminal = require('terminal-duplex')
const terminal = new Terminal()
x.on('some output', data=> terminal.log(data)) //console.logs
const listener = input=> terminal.log('user inputted:', input)
terminal.listen(listener) //can add as many as you want
terminal.unlisten(listener) //if you want you can also unlisten when you're done
terminal.close() //unhooks from input and outputsalternatively instead of using terminal.log you could just pass true into the constructor and it will overwrite console.log everywhere.
const Terminal = require('terminal-duplex')
const terminal = new Terminal(true)
x.on('some output', data=> console.log(data))
const listener = input=> console.log('user inputted:', input)
terminal.listen(listener) //can add as many as you want
terminal.unlisten(listener) //if you want you can also unlisten when you're done
terminal.close() //unhooks from input and outputsWhat is this?
Turns this:

Into this:



Amazingly something like this didn't exist already.
