nodejs如何打印顶部的控制台

时间:2013-10-26 09:05:11

标签: node.js console-application command-line-interface console.log

让我说我想做

有时像linux或使用nodejs的unix TOP。

例如

EXMPLE APP

ram usage : 30MB
processor usage : 20%

// above this line refreshed and but a fixed position
---------- LOGS ------------
// below this line is refreshed and max last 5 console.logs

example : server down at x
example : server down at y
example : server down at y
example : server down at y
example : server down at y

所以屏幕不会下降所以

// missing ram usage and processor usage as the page go down
example : server down at x
example : server down at y
example : server down at y
example : server down at y
example : server down at y
example : server down at x
example : server down at y
example : server down at y
example : server down at y
example : server down at y

我从哪里开始?,有什么好工具吗?

2 个答案:

答案 0 :(得分:3)

Linux中的顶级是使用ncurses库实现的。这里有一个为ncurses提供Node.js绑定的项目:https://github.com/mscdex/node-ncurses

答案 1 :(得分:1)

如果你想要一个原生的解决方案,试试charm,但它绝对不如ncurses强大。

相关问题