docs: function tryUnshift(stream, result, desiredLength, emptySlice) {
    if (typeof stream.unshift !== 'function') {
      debug('Unable to unshift, stream does not have an unshift method.');
      return result;
    }
  
    const errorListeners = stream.listeners('error');
    stream.removeAllListeners('error');
  
    // Note:  Don't rely on the EventEmitter throwing on 'error' without
    // listeners, since it may be thrown in the stream's attached domain.
    let unshiftErr;
    function onUnshiftError(err) { unshiftErr = err; }
    stream.on('error', onUnshiftError);
  
    let resultLength = result.length;
    try {
      if (Array.isArray(result)) {
        while (resultLength > desiredLength && !unshiftErr) {
          stream.unshift(result[resultLength - 1]);
          if (!unshiftErr) {
            resultLength -= 1;
          }
        }
      } else {
        stream.unshift(result.slice(desiredLength));
        if (!unshiftErr) {
          resultLength = desiredLength;
        }
      }
    } catch (err) {
      unshiftErr = err;
    }
  
    if (unshiftErr) {
      debug('Unable to unshift data: ', unshiftErr);
    }
  
    stream.removeListener('error', onUnshiftError);
    errorListeners.forEach((errorListener) => {
      stream.on('error', errorListener);
    });
  
    return resultLength === 0 && !emptySlice ? null
      : resultLength < result.length ? result.slice(0, resultLength)
        : result;
  }