2
"source": "doc/api/tty.markdown",
8
"stabilityText": "Unstable",
9
"desc": "<p>The <code>tty</code> module houses the <code>tty.ReadStream</code> and <code>tty.WriteStream</code> classes. In\nmost cases, you will not need to use this module directly.\n\n</p>\n<p>When node detects that it is being run inside a TTY context, then <code>process.stdin</code>\nwill be a <code>tty.ReadStream</code> instance and <code>process.stdout</code> will be\na <code>tty.WriteStream</code> instance. The preferred way to check if node is being run in\na TTY context is to check <code>process.stdout.isTTY</code>:\n\n</p>\n<pre><code>$ node -p -e "Boolean(process.stdout.isTTY)"\ntrue\n$ node -p -e "Boolean(process.stdout.isTTY)" | cat\nfalse</code></pre>\n",
12
"textRaw": "tty.isatty(fd)",
15
"desc": "<p>Returns <code>true</code> or <code>false</code> depending on if the <code>fd</code> is associated with a\nterminal.\n\n\n</p>\n",
27
"textRaw": "tty.setRawMode(mode)",
30
"desc": "<p>Deprecated. Use <code>tty.ReadStream#setRawMode()</code>\n(i.e. <code>process.stdin.setRawMode()</code>) instead.\n\n\n</p>\n",
44
"textRaw": "Class: ReadStream",
47
"desc": "<p>A <code>net.Socket</code> subclass that represents the readable portion of a tty. In normal\ncircumstances, <code>process.stdin</code> will be the only <code>tty.ReadStream</code> instance in any\nnode program (only when <code>isatty(0)</code> is true).\n\n</p>\n",
50
"textRaw": "rs.isRaw",
52
"desc": "<p>A <code>Boolean</code> that is initialized to <code>false</code>. It represents the current "raw" state\nof the <code>tty.ReadStream</code> instance.\n\n</p>\n"
57
"textRaw": "rs.setRawMode(mode)",
60
"desc": "<p><code>mode</code> should be <code>true</code> or <code>false</code>. This sets the properties of the\n<code>tty.ReadStream</code> to act either as a raw device or default. <code>isRaw</code> will be set\nto the resulting mode.\n\n\n</p>\n",
74
"textRaw": "Class: WriteStream",
76
"name": "WriteStream",
77
"desc": "<p>A <code>net.Socket</code> subclass that represents the writable portion of a tty. In normal\ncircumstances, <code>process.stdout</code> will be the only <code>tty.WriteStream</code> instance\never created (and only when <code>isatty(1)</code> is true).\n\n</p>\n",
80
"textRaw": "ws.columns",
82
"desc": "<p>A <code>Number</code> that gives the number of columns the TTY currently has. This property\ngets updated on "resize" events.\n\n</p>\n"
87
"desc": "<p>A <code>Number</code> that gives the number of rows the TTY currently has. This property\ngets updated on "resize" events.\n\n</p>\n"
92
"textRaw": "Event: 'resize'",
95
"desc": "<p><code>function () {}</code>\n\n</p>\n<p>Emitted by <code>refreshSize()</code> when either of the <code>columns</code> or <code>rows</code> properties\nhas changed.\n\n</p>\n<pre><code>process.stdout.on('resize', function() {\n console.log('screen size has changed!');\n console.log(process.stdout.columns + 'x' + process.stdout.rows);\n});</code></pre>\n",