Skip to content

Instantly share code, notes, and snippets.

@stagas stagas/prompt.js
Created Aug 7, 2011

Embed
What would you like to do?
prompt
var readline = require('readline')
, rl = readline.createInterface(process.stdin, process.stdout)
function prompt (str, cb) {
rl.setPrompt(str)
rl.prompt()
rl.once('line', cb)
}
prompt('> ', function (str) {
console.log(str)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.