ReadStream

TTY. ReadStream

new ReadStream(fd) → {ReadStream}

Creates a new TTY read stream.

Source:
Parameters:
Name Type Description
fd number

The file descriptor to read from.

Returns:
Type:
ReadStream

Methods

destroy()

Stops the TTY stream from reading input.

Source:

read() → {Promise.<(Uint8Array|string)>}

Returns a promise which is fulfilled when stdin can return a chunk.

Source:
Returns:
Type:
Promise.<(Uint8Array|string)>

The chunk read from stdin.

setEncoding(encodingopt)

Sets the encoding for the TTY read stream.

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

The character encoding to use.

setRawMode(modeopt)

Configures tty.ReadStream to operate in raw mode.

Source:
Parameters:
Name Type Attributes Default Description
mode boolean <optional>
false

Whether to enable raw mode. Defaults to false.