Skip to content

Conversation

@LiviaMedeiros
Copy link
Member

fs.Stats and fs.BigIntStats are similar, but separate classes. Currently, the fs documentation gives wrong impression, as if BigIntStats is an alias or subclass of Stats.
Making the difference more clear and explicit might help improve the accuracy of type definitions.

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. labels Nov 20, 2025
@Renegade334
Copy link
Member

My read was always that this was an intentional "legal fiction", similar to how classes like KeyObject are documented to be a single entity but are actually implemented as a class tree. The BigIntStats constructor isn't part of the public API surface, even though it's observable.

@LiviaMedeiros
Copy link
Member Author

Yes, it can be viewed that way. IMHO unlike KeyObject which is an useful higher level abstraction, or e.g. StatFs which actually behaves similar to how Stats is described, Stats doesn't really benefit from being documented as single class. Are there any upsides, aside from functions having single-type return value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants