diff --git a/lib/events.js b/lib/events.js index 837b30f311d4a7..b8290619408390 100644 --- a/lib/events.js +++ b/lib/events.js @@ -1051,8 +1051,8 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) { * @param {{ * signal: AbortSignal; * close?: string[]; - * highWatermark?: number, - * lowWatermark?: number + * highWaterMark?: number, + * lowWaterMark?: number * }} [options] * @returns {AsyncIterator} */ @@ -1062,10 +1062,12 @@ function on(emitter, event, options = kEmptyObject) { validateAbortSignal(signal, 'options.signal'); if (signal?.aborted) throw new AbortError(undefined, { cause: signal?.reason }); - const highWatermark = options.highWatermark ?? NumberMAX_SAFE_INTEGER; - validateInteger(highWatermark, 'options.highWatermark', 1); - const lowWatermark = options.lowWatermark ?? 1; - validateInteger(lowWatermark, 'options.lowWatermark', 1); + // Support both highWaterMark and highWatermark for backward compatibility + const highWatermark = options.highWaterMark ?? options.highWatermark ?? NumberMAX_SAFE_INTEGER; + validateInteger(highWatermark, 'options.highWaterMark', 1); + // Support both lowWaterMark and lowWatermark for backward compatibility + const lowWatermark = options.lowWaterMark ?? options.lowWatermark ?? 1; + validateInteger(lowWatermark, 'options.lowWaterMark', 1); // Preparing controlling queues and variables FixedQueue ??= require('internal/fixed_queue'); diff --git a/lib/internal/readline/interface.js b/lib/internal/readline/interface.js index e26fa6561e8679..8ae051e4eadbeb 100644 --- a/lib/internal/readline/interface.js +++ b/lib/internal/readline/interface.js @@ -1359,7 +1359,7 @@ class Interface extends InterfaceConstructor { this[kLineObjectStream] = EventEmitter.on( this, 'line', { close: ['close'], - highWatermark: 1024, + highWaterMark: 1024, [kFirstEventParam]: true, }); }