WriteStream

TTY. WriteStream

new WriteStream(fd) → {WriteStream}

Creates a new TTY write stream.

Source:
Parameters:
Name Type Description
fd number

The file descriptor to write to.

Returns:
Type:
WriteStream

Methods

clearLine(directionopt)

Clears the current line in this WriteStream.

Source:
Parameters:
Name Type Attributes Default Description
direction number <optional>
1

Which part of the line to clear: -1 clears to the left of the cursor, 1 clears to the right, and 0 clears the entire line.

clearScreenDown()

Clears the WriteStream downward from the cursor.

Source:

cursorTo(x, yopt)

Moves this WriteStream's cursor to the specified position.

Source:
Parameters:
Name Type Attributes Description
x number

The horizontal position (column).

y number <optional>

The vertical position (row). If omitted, only the horizontal position is changed.

end(dataopt, encodingopt)

Marks the TTY stream as no longer writable.

Source:
Parameters:
Name Type Attributes Description
data String | Uint8Array <optional>

The last data to be written to the TTY stream.

encoding String <optional>

The character encoding to use.

getWindowSize() → {Array.<number>}

Returns the size of the TTY.

Source:
Returns:
Type:
Array.<number>

An array containing 2 numbers [numColumns, numRows].

moveCursor(dx, dy)

Moves this WriteStream's cursor relative to its current position.

Source:
Parameters:
Name Type Description
dx number

The horizontal displacement.

dy number

The vertical displacement.

setEncoding(encodingopt)

Sets the encoding for the TTY write stream.

Source:
Parameters:
Name Type Attributes Default Description
encoding String <optional>
utf-8

The character encoding to use.

write(data, encodingopt)

Writes contents to the TTY stream.

Source:
Parameters:
Name Type Attributes Description
data String | Uint8Array

The data to be written to the TTY.

encoding String <optional>

The character encoding to use.