From 460a501d3030e503370f9e3a46d2b4f625668a52 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 #7938 --- 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 1984b5642e305b..dfdb6bf29811d5 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