分类: Node.js

Node.JS Gathering User Input – readline






readline doc : http://nodejs.org/api/readline.html

首先 createInterface:

var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

其次 ask question:

interface.question('What is your favorite food?', function(answer) {
console.log('Oh, so your favorite food is ' + answer);
});




发表评论

Webmentions

  • Node.JS Module 应用 | Ian's Blog

    […] readline – Gathering User Input […]