Skip to content

Commit

Permalink
doc,tty: add documentation for ReadStream and WriteStream
Browse files Browse the repository at this point in the history
Co-authored-by: Qingyu Deng <i@ayase-lab.com>
  • Loading branch information
jakecastelli and Ayase-252 committed Jun 24, 2024
1 parent 4c730ae commit f6897de
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions doc/api/tty.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,33 @@ Represents the writable side of a TTY. In normal circumstances,
`tty.WriteStream` instances created for a Node.js process and there
should be no reason to create additional instances.

### `new tty.ReadStream(fd[, options])`

<!-- YAML
added: v0.5.8
changes:
- version: v0.9.4
description: The `options` argument is supported.
-->

* `fd` {number} A file descriptor associated with a TTY.
* `options` {Object} Options passed to parent `net.Socket`,
see `options` of [`net.Socket` constructor][].
* Returns {tty.ReadStream}

Creates a `ReadStream` for `fd` associated with a TTY.

### `new tty.WriteStream(fd)`

<!-- YAML
added: v0.5.8
-->

* `fd` {number} A file descriptor associated with a TTY.
* Returns {tty.WriteStream}

Creates a `WriteStream` for `fd` associated with a TTY.

### Event: `'resize'`

<!-- YAML
Expand Down Expand Up @@ -314,6 +341,7 @@ The `tty.isatty()` method returns `true` if the given `fd` is associated with
a TTY and `false` if it is not, including whenever `fd` is not a non-negative
integer.

[`net.Socket` constructor]: net.md#net_new_socket_options
[`process.stderr`]: process.md#processstderr
[`process.stdin`]: process.md#processstdin
[`process.stdout`]: process.md#processstdout
Expand Down
3 changes: 3 additions & 0 deletions tools/doc/type-parser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ const customTypesMap = {

'Tracing': 'tracing.html#tracing-object',

'tty.ReadStream': 'tty.html#tty_class_tty_readstream',
'tty.WriteStream': 'tty.html#tty_class_tty_writestream',

'URL': 'url.html#the-whatwg-url-api',
'URLSearchParams': 'url.html#class-urlsearchparams',

Expand Down

0 comments on commit f6897de

Please sign in to comment.