From 1650bcf4914239e1edc87e78ad92ab2f347fa1de Mon Sep 17 00:00:00 2001 From: zero1five Date: Sun, 2 Jun 2019 03:04:56 +0800 Subject: [PATCH] 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 PR-URL: https://github.com/nodejs/node/pull/28007 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- 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 a5c55f5ca1e95d..155e39906bc9e6 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -503,6 +503,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