From a9f8b62b47588c78651bd0cf34fd1a9078b8d635 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 23 Jul 2019 09:40:13 +0200 Subject: [PATCH] stream: add readableEnded Adds a readableEnded property and improved finished compat with possible stream-like objects. PR-URL: https://github.com/nodejs/node/pull/28814 Refs: https://github.com/nodejs/node/issues/28813 Reviewed-By: Matteo Collina Reviewed-By: Rich Trott --- doc/api/stream.md | 9 ++++++ lib/_stream_readable.js | 10 +++++++ lib/internal/streams/async_iterator.js | 2 +- lib/internal/streams/end-of-stream.js | 3 +- test/parallel/test-stream-finished.js | 9 ++++++ test/parallel/test-stream-readable-ended.js | 33 +++++++++++++++++++++ 6 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 test/parallel/test-stream-readable-ended.js diff --git a/doc/api/stream.md b/doc/api/stream.md index 92a3e82bd188d2..dd379f4d5ad6ab 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1126,6 +1126,15 @@ added: v12.7.0 Getter for the property `encoding` of a given `Readable` stream. The `encoding` property can be set using the [`readable.setEncoding()`][] method. +##### readable.readableEnded + + +* {boolean} + +Becomes `true` when [`'end'`][] event is emitted. + ##### readable.readableHighWaterMark