From 4a01aa8ab940b31de4585b201160c37cd184cdc5 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sun, 14 Jul 2019 13:20:19 +0200 Subject: [PATCH] http: bytesWritten for http/1 --- doc/api/fs.md | 6 ++-- doc/api/http.md | 10 ++++++ doc/api/http2.md | 10 ++++++ doc/api/stream.md | 10 ++++++ lib/_http_outgoing.js | 5 +++ lib/_stream_duplex.js | 10 ++++++ lib/_stream_writable.js | 14 +++++++++ lib/internal/fs/streams.js | 3 -- lib/internal/http2/compat.js | 5 +++ .../test-http-outgoing-bytes-written.js | 25 +++++++++++++++ ...tp2-compat-serverresponse-bytes-written.js | 26 ++++++++++++++++ .../test-stream-writable-bytes-written.js | 31 +++++++++++++++++++ 12 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 test/parallel/test-http-outgoing-bytes-written.js create mode 100644 test/parallel/test-http2-compat-serverresponse-bytes-written.js create mode 100644 test/parallel/test-stream-writable-bytes-written.js diff --git a/doc/api/fs.md b/doc/api/fs.md index 58b17c3b21902a..736de6476f3d53 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -892,8 +892,10 @@ Fires immediately after `'open'`. added: v0.4.7 --> -The number of bytes written so far. Does not include data that is still queued -for writing. +{integer} + +Integer value that indicates how many bytes has been written to +the response body (not the amount flushed). ### writeStream.path + +* {integer} + +Integer value that indicates how many bytes has been written to +the response body (not the amount flushed). + ### response.connection + +* {integer} + +Integer value that indicates how many bytes has been written to +the response body (not the amount flushed). + #### response.connection + +* {integer} + +Integer value that indicates how many bytes has been written to +the stream (not the amount flushed). In `objectMode` this +value represents the number of objects written. ##### writable.cork()