Created
April 14, 2016 03:52
-
-
Save alivesay/d86149e876881186980944e8533862ff to your computer and use it in GitHub Desktop.
This file contains hidden or 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 readline = require('readline'); | |
const say = require('say'); | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); | |
const recursiveAsyncReadLine = () => { | |
rl.question('INPUT: ', (input) => { | |
if (input == 'exit') return rl.close(); | |
try { | |
say.stop(); | |
} catch (e) {} | |
say.speak(input); | |
recursiveAsyncReadLine(); | |
}); | |
}; | |
console.log('\033c') | |
recursiveAsyncReadLine(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment