Skip to content

Commit

Permalink
doc: add links between cork() and uncork()
Browse files Browse the repository at this point in the history
Writable.cork() and Writable.uncork() are meant to be documented
together, but we maintain a lexicographic order. This commit
introduces some links between the two.

Fixes: #7340
PR-URL: #11222
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
mcollina authored and MylesBorins committed Mar 9, 2017
1 parent 7aebc69 commit 72adba4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ buffer that would have an adverse impact on performance. In such situations,
implementations that implement the `writable._writev()` method can perform
buffered writes in a more optimized manner.

See also: [`writable.uncork()`][].

##### writable.end([chunk][, encoding][, callback])
<!-- YAML
added: v0.9.4
Expand Down Expand Up @@ -394,7 +396,7 @@ added: v0.11.2
The `writable.uncork()` method flushes all data buffered since
[`stream.cork()`][] was called.

When using `writable.cork()` and `writable.uncork()` to manage the buffering
When using [`writable.cork()`][] and `writable.uncork()` to manage the buffering
of writes to a stream, it is recommended that calls to `writable.uncork()` be
deferred using `process.nextTick()`. Doing so allows batching of all
`writable.write()` calls that occur within a given Node.js event loop phase.
Expand All @@ -406,7 +408,7 @@ stream.write('data ');
process.nextTick(() => stream.uncork());
```

If the `writable.cork()` method is called multiple times on a stream, the same
If the [`writable.cork()`][] method is called multiple times on a stream, the same
number of calls to `writable.uncork()` must be called to flush the buffered
data.

Expand All @@ -422,6 +424,8 @@ process.nextTick(() => {
});
```

See also: [`writable.cork()`][].

##### writable.write(chunk[, encoding][, callback])
<!-- YAML
added: v0.9.4
Expand Down Expand Up @@ -2018,6 +2022,8 @@ readable buffer so there is nothing for a user to consume.
[`stream.uncork()`]: #stream_writable_uncork
[`stream.unpipe()`]: #stream_readable_unpipe_destination
[`stream.wrap()`]: #stream_readable_wrap_stream
[`writable.cork()`]: #stream_writable_cork
[`writable.uncork()`]: #stream_writable_uncork
[API for Stream Consumers]: #stream_api_for_stream_consumers
[API for Stream Implementers]: #stream_api_for_stream_implementers
[child process stdin]: child_process.html#child_process_child_stdin
Expand Down

0 comments on commit 72adba4

Please sign in to comment.