doc: clarify fs.ReadStream and fs.WriteStream are not constructable

Add explicit wording that fs.ReadStream and fs.WriteStream should not
be constructed directly, matching the existing pattern used by fs.Stats
("not to be created directly using the new keyword"). The factory
functions fs.createReadStream() and fs.createWriteStream() are the
supported API.

Fixes: https://github.com/nodejs/node/issues/40546

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR-URL: https://github.com/nodejs/node/pull/62208
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Kit DallegeandClaude Opus 4.6 authored and Antoine du Hamel committed 2026-04-10 14:52:24 +02:00
1 parent 78ac17f426
commit ba0a82a1e1
1 file changed
+4 -4
+4 -4
View File
@@ -7138,8 +7138,8 @@ added: v0.1.93
* Extends: {stream.Readable}
Instances of {fs.ReadStream} are created and returned using the
[`fs.createReadStream()`][] function.
Instances of {fs.ReadStream} cannot be constructed directly. They are created and
returned using the [`fs.createReadStream()`][] function.
#### Event: `'close'`
@@ -7909,8 +7909,8 @@ added: v0.1.93
* Extends {stream.Writable}
Instances of {fs.WriteStream} are created and returned using the
[`fs.createWriteStream()`][] function.
Instances of {fs.WriteStream} cannot be constructed directly. They are created and
returned using the [`fs.createWriteStream()`][] function.
#### Event: `'close'`