From 6ca23d7846cb47e84fd344543e394e50938540be Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Fri, 30 Jul 2021 14:18:38 +0200 Subject: [PATCH] Revert "stream: add readableDidRead" This reverts commit 83060510015c2ad05b156af54938d05e9b2df5ae. PR-URL: https://github.com/nodejs/node/pull/39589 Refs: https://github.com/nodejs/undici/pull/907 Reviewed-By: Matteo Collina Reviewed-By: Benjamin Gruenbaum --- doc/api/stream.md | 11 +++ lib/_http_incoming.js | 1 - lib/_http_server.js | 2 +- lib/internal/streams/readable.js | 19 ++-- test/parallel/test-stream-readable-didRead.js | 98 +++++++++++++++++-- 5 files changed, 112 insertions(+), 19 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index fc66885ebc9203..312f200e61c4d5 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1261,6 +1261,17 @@ added: v11.4.0 Is `true` if it is safe to call [`readable.read()`][stream-read], which means the stream has not been destroyed or emitted `'error'` or `'end'`. +##### `readable.readableDidRead` + + +* {boolean} + +Allows determining if the stream has been or is about to be read. +Returns true if `'data'`, `'end'`, `'error'` or `'close'` has been +emitted. + ##### `readable.readableEncoding`