From 4a87abb8e85986196aa36e2f95a633573fdf947b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Mon, 1 Aug 2016 21:31:16 +0200 Subject: [PATCH] fs: add bytesRead to ReadStream Add a property named bytesRead that exposes how many bytes that have currently been read from the file. This brings consistency with WriteStream that has bytesWritten and net.Socket which have both bytesRead and bytesWritten. Fixes: https://github.com/nodejs/node/issues/#7938 PR-URL: https://github.com/nodejs/node/pull/7942 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis --- doc/api/fs.md | 7 +++++++ lib/fs.js | 5 ++++- test/parallel/test-fs-read-stream.js | 12 ++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 32ffed51c07..ab8c8a92bdf 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -181,6 +181,13 @@ added: v0.1.93 Emitted when the `ReadStream`'s underlying file descriptor has been closed using the `fs.close()` method. +### readStream.bytesRead + + +The number of bytes read so far. + ### readStream.path