From 6763bede4c1c1c4c163f5a7fb820b77e6318e402 Mon Sep 17 00:00:00 2001 From: Matt Probert <1196252+mattpr@users.noreply.github.com> Date: Mon, 7 Mar 2022 22:08:40 +0100 Subject: [PATCH] doc: readline `'line'` event emits final line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated docs to reflect current behaviour of readline: final line of input will be emitted via `'line'` event when input stream `'end'` event is emitted even when the input is not newline terminated. Refs: https://github.com/nodejs/node-v0.x-archive/issues/7238 PR-URL: https://github.com/nodejs/node/pull/42214 Reviewed-By: Antoine du Hamel Reviewed-By: Tobias Nießen Reviewed-By: Benjamin Gruenbaum Reviewed-By: Luigi Pinca --- doc/api/readline.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/readline.md b/doc/api/readline.md index bff9cb1ba296a8..a6751441010f94 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -82,6 +82,9 @@ The `'line'` event is emitted whenever the `input` stream receives an end-of-line input (`\n`, `\r`, or `\r\n`). This usually occurs when the user presses Enter or Return. +The `'line'` event is also emitted if new data has been read from a stream and +that stream ends without a final end-of-line marker. + The listener function is called with a string containing the single line of received input.