Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation for fs.statfs with detailed descriptions and examples #57062

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nileshsheth
Copy link

Summary

This PR enhances the documentation for fs.statfs by:

  • Adding a detailed breakdown of the returned fs.StatFs object.
  • Providing clear explanations of each property.
  • Including example usages for both normal and bigint: true options.
  • Improving readability for better developer understanding.

Changes Made

  • Updated doc/api/fs.md with improved descriptions.
  • Added code examples demonstrating usage.

Why?

  • The original documentation lacked details about the returned object.
  • No examples were provided, making it unclear for developers.

Related Issue

Closes nodejs/node#50749


Let me know if any additional improvements are needed! 🚀

@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 Feb 15, 2025
doc/api/fs.md Outdated
@@ -4451,28 +4451,62 @@ Stats {
}
```

### `fs.statfs(path[, options], callback)`
### fs.statfs(path[, options], callback)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why you removed the backticks from the header

Suggested change
### fs.statfs(path[, options], callback)
### `fs.statfs(path[, options], callback)`

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! I’ve restored the backticks and fixed the parameter formatting for consistency. Please review the changes.

doc/api/fs.md Outdated
Comment on lines 4458 to 4476
#### **Parameters**
- `path` **{string|Buffer|URL}** - The file or directory path to query.
- `options` **{Object}** *(Optional)*
- `bigint` **{boolean}** - If `true`, numeric values in the returned `fs.StatFs` object will be `BigInt` instead of `number`. Default: `false`.
- `callback` **{Function}** - Function called with the result:
- `err` **{Error}** - If an error occurs, contains error details.
- `stats` **{fs.StatFs}** - Contains file system statistics.

#### **Returned `fs.StatFs` Object Properties**
The returned `fs.StatFs` object contains:
- `type` **{number}** - The type of filesystem.
- `bsize` **{number}** - Optimal transfer block size.
- `blocks` **{number|BigInt}** - Total data blocks in the filesystem.
- `bfree` **{number|BigInt}** - Free blocks available to unprivileged users.
- `bavail` **{number|BigInt}** - Free blocks for privileged users.
- `files` **{number|BigInt}** - Total file nodes in the filesystem.
- `ffree` **{number|BigInt}** - Free file nodes.
- `fsid` **{number}** - File system ID.
- `namemax` **{number}** - Maximum filename length.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not align with the formatting for everything else. The #### headers for parameters is unnecessary, as are the ** around the type indicators.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! I’ve restored the backticks and fixed the parameter formatting for consistency. Please review the changes.

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.

Missing documentation in fs.StatFs
3 participants