function pipe(destination, options) {
    emitter.on('data', ondata)
    emitter.on('error', onerror)
    emitter.on('end', cleanup)
    emitter.on('close', cleanup)

    // If the `end` option is not supplied, `destination.end()` will be
    // called when the `end` or `close` events are received.
    // @ts-expect-error `_isStdio` is available on `std{err,out}`
    if (!destination._isStdio && (!options || options.end !== false)) {
      emitter.on('end', onend)
    }

    destination.on('error', onerror)
    destination.on('close', cleanup)

    destination.emit('pipe', emitter)

    return destination

    /**
     * End destination stream.
     *
     * @returns {undefined}
     *   Nothing.
     */
    function onend() {
      if (destination.end) {
        destination.end()
      }
    }

    /**
     * Handle data.
     *
     * @param {string} chunk
     *   Data.
     * @returns {undefined}
     *   Nothing.
     */
    function ondata(chunk) {
      if (destination.writable) {
        destination.write(chunk)
      }
    }

    /**
     * Clean listeners.
     *
     * @returns {undefined}
     *   Nothing.
     */
    function cleanup() {
      emitter.removeListener('data', ondata)
      emitter.removeListener('end', onend)
      emitter.removeListener('error', onerror)
      emitter.removeListener('end', cleanup)
      emitter.removeListener('close', cleanup)

      destination.removeListener('error', onerror)
      destination.removeListener('close', cleanup)
    }

    /**
     * Close dangling pipes and handle unheard errors.
     *
     * @param {Error | null | undefined} [error]
     *   Error, if any.
     * @returns {undefined}
     *   Nothing.
     */
    function onerror(error) {
      cleanup()

      if (!emitter.listenerCount('error')) {
        throw error // Unhandled stream error in pipe.
      }
    }
  }
Pipe the processor into a writable stream.

Basically `Stream#pipe`, but inlined and simplified to keep the bundled
size down.
See: <https://github.com/nodejs/node/blob/43a5170/lib/internal/streams/legacy.js#L13>.

@template {NodeJS.WritableStream} Stream
  Writable stream.
@param {Stream} destination
  Stream to pipe into.
@param {PipeOptions | null | undefined} [options]
  Configuration.
@returns {Stream}
  Destination stream.