decode-keypress
v0.0.3
Published
decode keypress events from process.stdin
Downloads
3
Readme
decode-keypress
Decode process.stdin 'data' events. Most of the decode logic was forked from keypress;
installation
$ npm install decode-keypress
Usage
const decodeKeypress = require('decode-keypress');
process.stdin.setEncoding('utf8');
process.stdin.setRawMode(true);
process.stdin.on('data', data => {
const key = decodeKeypress(data);
if (key.name === 'c' && key.ctrl) {
process.exit();
}
console.log(key.name);
});