Skip to content

Commit 0d4b0ed

Browse files
mcollinaitaloacasas
authored andcommitted
doc: add links between cork() and uncork()
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 <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 9d5ffa6 commit 0d4b0ed

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

doc/api/stream.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ buffer that would have an adverse impact on performance. In such situations,
347347
implementations that implement the `writable._writev()` method can perform
348348
buffered writes in a more optimized manner.
349349

350+
See also: [`writable.uncork()`][].
351+
350352
##### writable.end([chunk][, encoding][, callback])
351353
<!-- YAML
352354
added: v0.9.4
@@ -394,7 +396,7 @@ added: v0.11.2
394396
The `writable.uncork()` method flushes all data buffered since
395397
[`stream.cork()`][] was called.
396398

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

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

@@ -422,6 +424,8 @@ process.nextTick(() => {
422424
});
423425
```
424426

427+
See also: [`writable.cork()`][].
428+
425429
##### writable.write(chunk[, encoding][, callback])
426430
<!-- YAML
427431
added: v0.9.4
@@ -2018,6 +2022,8 @@ readable buffer so there is nothing for a user to consume.
20182022
[`stream.uncork()`]: #stream_writable_uncork
20192023
[`stream.unpipe()`]: #stream_readable_unpipe_destination
20202024
[`stream.wrap()`]: #stream_readable_wrap_stream
2025+
[`writable.cork()`]: #stream_writable_cork
2026+
[`writable.uncork()`]: #stream_writable_uncork
20212027
[API for Stream Consumers]: #stream_api_for_stream_consumers
20222028
[API for Stream Implementers]: #stream_api_for_stream_implementers
20232029
[child process stdin]: child_process.html#child_process_child_stdin

0 commit comments

Comments
 (0)