~ubuntu-branches/ubuntu/vivid/nodejs/vivid

« back to all changes in this revision

Viewing changes to doc/api/tty.json

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2013-08-14 00:16:46 UTC
  • mfrom: (7.1.40 sid)
  • Revision ID: package-import@ubuntu.com-20130814001646-bzlysfh8sd6mukbo
Tags: 0.10.15~dfsg1-4
* Update 2005 patch, adding a handful of tests that can fail on
  slow platforms.
* Add 1004 patch to fix test failures when writing NaN to buffer
  on mipsel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
  "source": "doc/api/tty.markdown",
 
3
  "modules": [
 
4
    {
 
5
      "textRaw": "TTY",
 
6
      "name": "tty",
 
7
      "stability": 2,
 
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 &quot;Boolean(process.stdout.isTTY)&quot;\ntrue\n$ node -p -e &quot;Boolean(process.stdout.isTTY)&quot; | cat\nfalse</code></pre>\n",
 
10
      "methods": [
 
11
        {
 
12
          "textRaw": "tty.isatty(fd)",
 
13
          "type": "method",
 
14
          "name": "isatty",
 
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",
 
16
          "signatures": [
 
17
            {
 
18
              "params": [
 
19
                {
 
20
                  "name": "fd"
 
21
                }
 
22
              ]
 
23
            }
 
24
          ]
 
25
        },
 
26
        {
 
27
          "textRaw": "tty.setRawMode(mode)",
 
28
          "type": "method",
 
29
          "name": "setRawMode",
 
30
          "desc": "<p>Deprecated. Use <code>tty.ReadStream#setRawMode()</code>\n(i.e. <code>process.stdin.setRawMode()</code>) instead.\n\n\n</p>\n",
 
31
          "signatures": [
 
32
            {
 
33
              "params": [
 
34
                {
 
35
                  "name": "mode"
 
36
                }
 
37
              ]
 
38
            }
 
39
          ]
 
40
        }
 
41
      ],
 
42
      "classes": [
 
43
        {
 
44
          "textRaw": "Class: ReadStream",
 
45
          "type": "class",
 
46
          "name": "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",
 
48
          "properties": [
 
49
            {
 
50
              "textRaw": "rs.isRaw",
 
51
              "name": "isRaw",
 
52
              "desc": "<p>A <code>Boolean</code> that is initialized to <code>false</code>. It represents the current &quot;raw&quot; state\nof the <code>tty.ReadStream</code> instance.\n\n</p>\n"
 
53
            }
 
54
          ],
 
55
          "methods": [
 
56
            {
 
57
              "textRaw": "rs.setRawMode(mode)",
 
58
              "type": "method",
 
59
              "name": "setRawMode",
 
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",
 
61
              "signatures": [
 
62
                {
 
63
                  "params": [
 
64
                    {
 
65
                      "name": "mode"
 
66
                    }
 
67
                  ]
 
68
                }
 
69
              ]
 
70
            }
 
71
          ]
 
72
        },
 
73
        {
 
74
          "textRaw": "Class: WriteStream",
 
75
          "type": "class",
 
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",
 
78
          "properties": [
 
79
            {
 
80
              "textRaw": "ws.columns",
 
81
              "name": "columns",
 
82
              "desc": "<p>A <code>Number</code> that gives the number of columns the TTY currently has. This property\ngets updated on &quot;resize&quot; events.\n\n</p>\n"
 
83
            },
 
84
            {
 
85
              "textRaw": "ws.rows",
 
86
              "name": "rows",
 
87
              "desc": "<p>A <code>Number</code> that gives the number of rows the TTY currently has. This property\ngets updated on &quot;resize&quot; events.\n\n</p>\n"
 
88
            }
 
89
          ],
 
90
          "events": [
 
91
            {
 
92
              "textRaw": "Event: 'resize'",
 
93
              "type": "event",
 
94
              "name": "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(&#39;resize&#39;, function() {\n  console.log(&#39;screen size has changed!&#39;);\n  console.log(process.stdout.columns + &#39;x&#39; + process.stdout.rows);\n});</code></pre>\n",
 
96
              "params": []
 
97
            }
 
98
          ]
 
99
        }
 
100
      ],
 
101
      "type": "module",
 
102
      "displayName": "TTY"
 
103
    }
 
104
  ]
 
105
}