-
Termios
Class to hold termios struct data.c_iflag
: Integer representing the input mode flags.c_oflag
: Integer representing the output mode flags.c_cflag
: Integer representing the character mode flags.c_lflag
: Integer representing the local mode flags.c_cc
: Object representing the control character settings.
constructor(arg)
: Create new termios object. To prefill termios data setarg
to a valid file descriptor or another Termios object.loadFrom(fd)
: Load termios data from file descriptorfd
.writeTo(fd, action)
: Set termios data of file descriptorfd
.action
must be one oftermios.ACTION
(defaults toTCSAFLUSH
).getInputSpeed()
: Returns input channel baud rate setting.getOutputSpeed()
: Returns output channel baud rate setting.setInputSpeed(speed)
: Sets input channel baud rate.speed
must be one of the predefined baudrates intermios.BAUD
.setOutputSpeed(speed)
: Sets output channel baud rate.speed
must be one of the predefined baudrates intermios.BAUD
.setSpeed(speed)
: Sets input and output channel baud rate.speed
must be one of the predefined baudrates intermios.BAUD
.setraw()
: Set termios data to raw mode (taken from Python).setcbreak()
: Set termios data to cbreak mode (taken from Python).toBuffer()
: Creates a node::Buffer representation of termios data.
The module exports known symbols defined by the underlying termios.h (platform dependent).
ALL_SYMBOLS
: All known symbols.IFLAGS
: Input mode symbols.OFLAGS
: Output mode symbols.CFLAGS
: Character mode symbols.LFLAGS
: Local mode symbols.CC
: Valid symbols defined for control character settings.ACTION
: Symbols defined fortcsetattr
(when the changes should be applied).FLUSH
: Symbols fortcflush
.FLOW
: Symbols fortcflow
.BAUD
: Defined baudrates of the platform.
isatty(fd)
: Test if file descriptorfd
is a tty.ttyname(fd)
: Return tty file name forfd
. Return empty string for an invalid file descriptor.ptsname(fd)
: Return pts file name for file descriptorfd
. This can only be used from the master end of a pty. For slave end usettyname
.tcgetattr(fd, termios)
: Get termios data for file descriptorfd
.termios
must be a Termios object.tcsetattr(fd, action, termios)
: Set termios data for file descriptorfd
.action
must be one oftermios.ACTION
.termios
must be a Termios object.tcsendbreak(fd, duration)
tcdrain(fd)
tcflush(fd, queue_selector)
tcflow(fd, flowaction)
cfgetispeed(termios)
cfgetospeed(termios)
cfsetispeed(termios, speed)
cfsetospeed(termios, speed)
The example demostrates how to switch off echoing on STDIN.
var Termios = require('node-termios').Termios;
var sym = require('node-termios').ALL_SYMBOLS;
var tty = new Termios(0);
tty.c_lflag &= ~(sym.ECHO | sym.ECHONL);
tty.writeTo(0);