Created
April 18, 2020 14:25
-
-
Save dpfrakes/67929e2be2ea2314e1938b2362586e72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const readline = require('readline'); | |
const moment = require('moment-timezone'); | |
readline.emitKeypressEvents(process.stdin); | |
process.stdin.setRawMode(true); | |
process.stdin.on('keypress', (str, key) => { | |
if (key.ctrl && key.name === 'c') { | |
process.exit(); | |
} else { | |
let d = moment().tz("America/New_York").format(); | |
fs.appendFile('movie-timestamps.txt', `${d} - [${key.name}]\n`, () => { console.log(key.name); }); | |
} | |
}); | |
console.log('Press any key...'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment