2

I'm writing a console application with Node.js. Think about it like a "tail -f" of some sort of file, but where you can also enter some "commands" which will act over the list.

A two windows console application: the top one with an unattended scrolling of rows, and the second one where I can enter text with the help of Readline.

Do you think I need ncurses or is there could be another - even more low level - way to directly address the screen (oh man, I remember the Int21h of DOS memories)?

Edit: I published the application: https://github.com/claudioc/jecho (still no "windows"... I just try to be smart about the \n :))

Claudio
  • 5,740
  • 5
  • 33
  • 40
  • Slightly related Q http://stackoverflow.com/questions/6912889/what-is-the-recommended-way-to-implement-text-scrolling-in-ncurses – Claudio Sep 25 '12 at 19:06
  • Node.js is pretty UNIX-ish. There's probably a way to extend it to provide access to Windows APIs I guess, but that sounds like a nightmare to me (probably because I'm also pretty UNIX-ish). The "console" is treated like a simple file. – Pointy Sep 25 '12 at 19:14
  • Mmmh, I'm not definitely talking about Windows here. In this context the "windows" are the two different part in which the screen (the terminal viewport) is splitted :) – Claudio Sep 25 '12 at 19:28
  • Right, well my point is that in Node's homeland of Linux, the connection between a running program and its terminal is simply a file descriptor. Access to the "screen" as such is way complicated. – Pointy Sep 25 '12 at 19:50

2 Answers2

2

Yeah, you'd need ncurses or termio or something like that. What you're trying to do would require you to control the terminal i/o buffers yourself, definitely lower level than node gives you by default.

saml
  • 6,702
  • 1
  • 34
  • 30
0

Does it really need to be a single application? You could just use screen. Split the screen horizontally, and have each window talking to node separately. The top window can just be a loop that polls node.js and prints the output.

john_fries
  • 115
  • 1
  • 6