A propriedade readStream.isTTY é uma interface de programação de aplicativo embutida da classe ReadStream dentro do módulo tty que é usada para verificar se o objeto de fluxo de leitura é uma instância de tty ou não. Ele sempre retornará verdadeiro para tty, ReadStream.

Sintaxe:

const readStream.isTTY

Valor de retorno: esta propriedade retorna true se o objeto de fluxo de leitura for uma instância de tty.

Exemplo 1: Nome do arquivo: index.js

// Node.js program to demonstrate the
// readStream.isTTY property
 
// Importing dgram module
var dgram = require('dgram');
 
// Creating and initializing client
// and server socket
var client = dgram.createSocket("udp4");
var server = dgram.createSocket("udp4");
 
// Handling the message event
server.on("message", function (msg) {
 
    // Creating and initializing a
    // ReadStream object
    let ReadStream = process.stdin;
 
    // Checking if it is instance of TTY
    // or not by using isTTY() method
    const status = ReadStream.isTTY;
 
    // Displaying the result
    if (status) {
        process.stdout.write(msg
            + "an instant of TTY" + "\n");
    } else {
        process.stdout.write(msg
            + "not an instant of TTY" + "\n");
    }
 
    // Exiting process
    process.exit();
})
 
// Binding server with port
.bind(1234, () => {
});
 
// Client sending message to server
client.send("It is ", 0, 7, 1234, "localhost");

Saída:

It is an instant of TTY

Exemplo 2: Nome do arquivo: index.js

// Node.js program to demonstrate the
// readStream.isTTY property
 
// Creating and initializing a
// ReadStream object
let ReadStream = process.stdin;
 
// Checking if it is instance of TTY
// or not by using isTTY() method
const status = ReadStream.isTTY;
 
// Displaying the result
if(status) {
   console.log("It is an instant of TTY");
} else {
   console.log("it is not an instant of TTY");
}

Execute o arquivo index.js usando o seguinte comando:

node index.js

Saída:

It is an instant of TTY

Referência: https://nodejs.org/dist/latest-v12.x/docs/api/tty.html#tty_readstream_istty