cork

open fun cork()(source)

The writable.cork() method forces all written data to be buffered in memory. The buffered data will be flushed when either the {@link uncork} or {@link end} methods are called.

The primary intent of writable.cork() is to accommodate a situation in which several small chunks are written to the stream in rapid succession. Instead of immediately forwarding them to the underlying destination, writable.cork() buffers all the chunks until writable.uncork() is called, which will pass them all to writable._writev(), if present. This prevents a head-of-line blocking situation where data is being buffered while waiting for the first small chunk to be processed. However, use of writable.cork() without implementing writable._writev() may have an adverse effect on throughput.

See also: writable.uncork(), writable._writev().

Since

v0.11.2