cork() and uncork()
Writable stream methods that hold writes in memory (cork) and then send them all together (uncork), cutting the number of system calls.
In more detail
They help when many tiny writes would otherwise each become a separate network packet. Uncork on the next tick, for example with process.nextTick, so nothing waits too long.
Related terms
- Writable stream — A Node.js stream you write data to, such as a file being written, an HTTP response or a socket.
- system call — A request a program makes to the kernel, such as open this file or start a new process.
Taught in
- Writable Streams: Drain Events & highWaterMark — Node.js Internals & Backend Services