The module readline-sync
, (source can be found here, npm page here) will do what you want, it looks like.
If you'd prefer to work at a lower level, it looks like it works by passing the stdin
file descriptor (stdin.fd
) to the synchronous fs
methods. For example:
fs.readSync(stdin.fd, buffer, 0, BUF_SIZE)