Skip to content

Instantly share code, notes, and snippets.

@christian-fei
Created January 31, 2018 14:53
Show Gist options
  • Save christian-fei/5873c819326f5204090ca4f895b0d65b to your computer and use it in GitHub Desktop.
Save christian-fei/5873c819326f5204090ca4f895b0d65b to your computer and use it in GitHub Desktop.
function query(text) {
return new Promise((resolve, reject) => {
process.stdin.resume()
process.stdout.write(text)
process.stdin.once('data', data => resolve(data.toString().trim()))
process.stdin.once('error', reject)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment