Repository navigation
fs: add static Stats.isStats() method - #67716
Open
LiviaMedeiros wants to merge 1 commit into
Open
LiviaMedeiros wants to merge 1 commit into
LiviaMedeiros wants to merge 1 commit into
Conversation
Signed-off-by: LiviaMedeiros <livia@cirno.name>
LiviaMedeiros
force-pushed
the
fs-stats-isstats
branch
from
November 22, 2026 23:38
8d82816 to
089ff38
Compare
jasnell
approved these changes
Nov 22, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #67716 +/- ##
==========================================
- Coverage 90.55% 90.53% -0.02%
==========================================
Files 801 801
Lines 284111 284128 +17
Branches 54879 54885 +6
==========================================
- Hits 257279 257240 -39
- Misses 17006 17051 +45
- Partials 9826 9837 +11
🚀 New features to boost your workflow:
|
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fs.Statsclass is very problematic because its shape depends on thebigintoption passed to thestatsfunctions.In the documentation, it's defined as single class that has "bigint" version. In the internal implementation, there are separate
StatsandBigIntStatsclasses. As result,stats instanceof fs.Statsin userland returns different results depending onbigintoption.This PR adds static
Stats.isStatsmethod that covers bothStatsandBigIntStats.This should help us to move forward with making
DEP0180to EOL (#67491) and potentially moving further (e.g. deprecatingbigintoption in favour of exposing nanosecond precision onStats, or rewriting internal implementation), providing users documented alternative toinstanceofchecks for now.This deliberately doesn't distinguish between
StatsandBigIntStatsand doesn't provide more specific checks to give us more freedom for internal changes.I'm open for any actionable suggestions here.