是否可以读取标准输入 从 Meteor 应用程序上的终端?我想使用 Node's readline 运行一些提示.
我在 readline 的页面上尝试了这个例子,但我只在没有等待答案的情况下将提示打印到终端:
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question("What do you think of node.js? ", function(answer) {
// TODO: Log the answer in a database
console.log("Thank you for your valuable feedback:", answer);
rl.close();
});
这段代码在普通的 NodeJS 脚本中工作得很好。
相关门票:
最佳答案
目前看来这不可能。 OP 向 MDG ( https://github.com/meteor/meteor/issues/4836 ) 打开了一个相关问题,该问题随后被关闭。
编写交互式命令行应用程序的推荐方法是直接使用 Node。
关于 meteor JS : how to read stdin from the terminal?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31690867/