Is it possible to simulate keyboard/mouse event in NodeJS?

Imagine that a NodeJS module, when invoked from console, outputs some introductory messages and then waits for user input (click enter or esc). This module already has and does everything we require, except that - wait-for-user-input prompt. So we wonder (I'm personally very new to NodeJS) if it is possible to execute console module programmatically and trigger an input event on it, so that it doesn't wait and proceed with the job right away?

You could use possibly use RobotJS for this.

Example code:

var robot = require("robotjs");

// Type user's password or something. 
robot.typeString("abc123");

Check out https://github.com/visionmedia/commander.js/. Great library for building a command line utility with Node.js. You can also take a peak under the covers if you need to role your own (this is what I did as commander didn't cover everything I needed) TJ has some great code to get some ideas from