From ae465f6fc4c2b4645e0ff4478b84ef27487f1802 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 3 Nov 2018 19:53:06 +0100 Subject: [PATCH] fs,net: standardize `pending` stream property Use the same property name as http2 does to indicate that the stream is in the state before the `ready` event is emitted. PR-URL: https://github.com/nodejs/node/pull/24067 Reviewed-By: Luigi Pinca Reviewed-By: Minwoo Jung Reviewed-By: James M Snell --- doc/api/fs.md | 20 ++++++++++++++++++++ doc/api/net.md | 12 ++++++++++++ lib/internal/fs/streams.js | 10 ++++++++++ lib/internal/http2/core.js | 2 +- lib/net.js | 9 ++++++++- test/parallel/test-fs-ready-event-stream.js | 11 +++++++++-- test/parallel/test-net-connect-buffer.js | 6 ++++++ 7 files changed, 66 insertions(+), 4 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index fc3ed3c6118843..bcf4a9f10db8cf 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -488,6 +488,16 @@ argument to `fs.createReadStream()`. If `path` is passed as a string, then `readStream.path` will be a string. If `path` is passed as a `Buffer`, then `readStream.path` will be a `Buffer`. +### readStream.pending + + +* {boolean} + +This property is `true` if the underlying file has not been opened yet, +i.e. before the `'ready'` event is emitted. + ## Class: fs.Stats + +* {boolean} + +This property is `true` if the underlying file has not been opened yet, +i.e. before the `'ready'` event is emitted. + ## fs.access(path[, mode], callback) + +* {boolean} + +This is `true` if the socket is not connected yet, either because `.connect()` +has not yet been called or because it is still in the process of connecting +(see [`socket.connecting`][]). + ### socket.ref()