readStream.setRawMode(mode)


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

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

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

在原始模式下,输入总是按字符逐个可用,不包括修饰键。此外,终端对输入字符的所有特殊处理都会被禁用,包括回显输入字符。 Ctrl+C 在这种模式下将不再触发 SIGINT。这种模式不会影响终端的输出处理,例如 Unix 终端上的换行转换。