From 5cd6cccf445ace23e8c2d51ade3be48dbaa5e463 Mon Sep 17 00:00:00 2001 From: zero1five Date: Sun, 2 Jun 2019 03:04:56 +0800 Subject: [PATCH 1/2] stream: add writableFinished add a new getter to duplex stream to replace the property `this .writableState.finished` of the object that inherited duplex. Refs: https://github.com/nodejs/node/issues/445 --- doc/api/stream.md | 10 +++++++ lib/_stream_duplex.js | 10 +++++++ lib/_stream_writable.js | 10 +++++++ .../test-stream-duplex-writable-finished.js | 30 +++++++++++++++++++ .../parallel/test-stream-writable-finished.js | 30 +++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100644 test/parallel/test-stream-duplex-writable-finished.js create mode 100644 test/parallel/test-stream-writable-finished.js diff --git a/doc/api/stream.md b/doc/api/stream.md index abefb4aa6bba77..06e63798f5b817 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -502,6 +502,16 @@ This property contains the number of bytes (or objects) in the queue ready to be written. The value provides introspection data regarding the status of the `highWaterMark`. +##### writable.writableFinished + + +* {boolean} + +Is `true` if all data has been flushed to the underlying system. After +the [`'finish'`][] event has been emitted. + ##### writable.writableObjectMode