diff --git a/doc/api/tty.md b/doc/api/tty.md index cc95bfa9ae86ba..87075b33ed70d0 100644 --- a/doc/api/tty.md +++ b/doc/api/tty.md @@ -98,29 +98,46 @@ process.stdout.on('resize', () => { }); ``` -### writeStream.columns +### writeStream.clearLine(dir) -A `number` specifying the number of columns the TTY currently has. This property -is updated whenever the `'resize'` event is emitted. +* `dir` {number} + * `-1` - to the left from cursor + * `1` - to the right from cursor + * `0` - the entire line -### writeStream.isTTY +`writeStream.clearLine()` clears the current line of this `WriteStream` in a +direction identified by `dir`. + +### writeStream.clearScreenDown() -A `boolean` that is always `true`. +`writeStream.clearScreenDown()` clears this `WriteStream` from the current +cursor down. -### writeStream.rows +### writeStream.columns -A `number` specifying the number of rows the TTY currently has. This property +A `number` specifying the number of columns the TTY currently has. This property is updated whenever the `'resize'` event is emitted. +### writeStream.cursorTo(x, y) + + +* `x` {number} +* `y` {number} + +`writeStream.cursorTo()` moves this `WriteStream`'s cursor to the specified +position. + ### writeStream.getColorDepth([env]) @@ -158,6 +175,43 @@ The `tty.isatty()` method returns `true` if the given `fd` is associated with a TTY and `false` if it is not, including whenever `fd` is not a non-negative integer. +### writeStream.getWindowSize() + +* Returns: {number[]} + +`writeStream.getWindowSize()` returns the size of the [TTY](tty.html) +corresponding to this `WriteStream`. The array is of the type +`[numColumns, numRows]` where `numColumns` and `numRows` represent the number +of columns and rows in the corresponding [TTY](tty.html). + +### writeStream.isTTY + + +A `boolean` that is always `true`. + +### writeStream.moveCursor(dx, dy) + + +* `dx` {number} +* `dy` {number} + +`writeStream.moveCursor()` moves this `WriteStream`'s cursor *relative* to its +current position. + +### writeStream.rows + + +A `number` specifying the number of rows the TTY currently has. This property +is updated whenever the `'resize'` event is emitted. + [`net.Socket`]: net.html#net_class_net_socket [`process.stdin`]: process.html#process_process_stdin [`process.stdout`]: process.html#process_process_stdout