meteor JS : how to read stdin from the terminal?

标签 meteor

是否可以读取标准输入 从 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 脚本中工作得很好。

相关门票:
  • https://github.com/practicalmeteor/meteor-mcli/issues/6
  • 最佳答案

    目前看来这不可能。 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/

    相关文章:

    meteor - 如何管理同步到 Meteor 客户端缓存的数据?

    javascript - Meteor 环境变量在生产中无效

    html - Meteor accounts - 自定义登录页面

    node.js - meteor 构建包没有响应

    javascript - 如何将数据从 meteor Controller 传递到 meteor 助手?

    meteor - 扩展 meteor 用户模型

    javascript - 获取多个 mongodb 文档数组并将它们合并以获得唯一值

    javascript - 单击编辑 jquery

    javascript - 全局助手正在覆盖 meteor handlebars 模板中的本地上下文

    javascript - 为什么我在 Meteor.js 教程上收到 "Your Application is crashing Error"?