Skip to content

Instantly share code, notes, and snippets.

View dariorlima's full-sized avatar
🏠
Working from home

Dário Ribeiro dariorlima

🏠
Working from home
View GitHub Profile
@newvertex
newvertex / KeyPressEvent.js
Created September 17, 2016 10:24
Example: Detect keypress event in Node.js console app
var readline = require('readline');
readline.emitKeypressEvents(process.stdin);
if (process.stdin.isTTY)
process.stdin.setRawMode(true);
process.stdin.on('keypress', (chunk, key) => {
if (key && key.name == 'q')
process.exit();