node package manager

tty-signals

Interpret signals from a readable stream

tty-signals

Listen for keypress events from a readable stream!

Example:

var signals = require("tty-signals")(process.stdin);

process.stdin.resume();

require("tty").setRawMode(true);

signals.on("leftArrow", function() {
  console.log("<");
});

Events (so far):

  • "leftArrow"
  • "rightArrow"
  • "upArrow"
  • "downArrow"
  • "^C"
  • "^D"

License:

MIT/X11