Skip to content

Instantly share code, notes, and snippets.

@alivesay
Created April 14, 2016 03:52
Show Gist options
  • Save alivesay/d86149e876881186980944e8533862ff to your computer and use it in GitHub Desktop.
Save alivesay/d86149e876881186980944e8533862ff to your computer and use it in GitHub Desktop.
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