readStream.setRawMode(mode)


  • mode <boolean> 如果为 true,则将 tty.ReadStream 配置为作为原始设备运行。 如果为 false,则将 tty.ReadStream 配置为以其默认模式运行。 readStream.isRaw 属性将会按最终的模式设置。
  • 返回: <this> 读取流的实例。

允许配置 tty.ReadStream,使其作为原始设备运行。

在原始模式中,输入始终可以逐个字符,但不包括修饰符。 此外,终端对字符的所有特殊处理都会被禁用,包括回显的输入字符。 在此模式中, CTRL+C 将不再产生 SIGINT

  • mode <boolean> If true, configures the tty.ReadStream to operate as a raw device. If false, configures the tty.ReadStream to operate in its default mode. The readStream.isRaw property will be set to the resulting mode.
  • Returns: <this> The read stream instance.

Allows configuration of tty.ReadStream so that it operates as a raw device.

When in raw mode, input is always available character-by-character, not including modifiers. Additionally, all special processing of characters by the terminal is disabled, including echoing input characters. CTRL+C will no longer cause a SIGINT when in this mode.