From a35b47018f02d263ee3e20d8faed7417afdc5a23 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 15 Nov 2026 16:39:53 +0000 Subject: [PATCH 1/2] fs: move DEP0180 to End-of-Life Calling the fs.Stats constructor directly, with or without new, now throws ERR_ILLEGAL_CONSTRUCTOR. fs.Stats instances are only created internally. The class remains exported from node:fs so that instanceof checks continue to work. Internally, instances are constructed through a private symbol. This has been a runtime deprecation since v22.0.0. Refs: https://github.com/nodejs/node/pull/52067 Refs: https://github.com/nodejs/node/pull/51879 Assisted-by: Claude Signed-off-by: James M Snell --- doc/api/deprecations.md | 11 +++++++--- doc/api/fs.md | 4 ++++ lib/internal/fs/utils.js | 10 ++++++--- test/parallel/test-fs-stat.js | 34 +++++++++++------------------- test/parallel/test-fs-watchfile.js | 24 ++++----------------- 5 files changed, 35 insertions(+), 48 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index fc333e937d6b..31c36c6ffa26 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -4051,6 +4051,9 @@ Please use the [`crypto.createHash()`][] method to create Hash instances. -Type: Runtime +Type: End-of-Life -Calling `fs.Stats` class directly with `Stats()` or `new Stats()` is -deprecated due to being internals, not intended for public use. +Calling `fs.Stats` class directly with `Stats()` or `new Stats()` throws an +`ERR_ILLEGAL_CONSTRUCTOR` error. The constructor is internal and not intended +for public use. The class remains exported, so `instanceof fs.Stats` checks +continue to work. ### DEP0181: `Hmac` constructor diff --git a/doc/api/fs.md b/doc/api/fs.md index 929ea3029576..1f4bfe68c955 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -7989,6 +7989,10 @@ i.e. before the `'ready'` event is emitted.