Terminal-emulator-like user interaction in nodejs