Skip to content

Commit 334064a

Browse files
committed
doc: clarify fs.StatFs field descriptions
Clarify that bsize is in bytes and serves as the unit for the block count fields (blocks, bfree, bavail). Add "multiply by bsize" hints so users can compute sizes without guessing units. Explain that type is a file system magic number with platform-specific values. Mention that ffree/files count inodes. Fixes: #50749
1 parent e42dbef commit 334064a

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

doc/api/fs.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7664,7 +7664,8 @@ added:
76647664
76657665
* Type: {number|bigint}
76667666
7667-
Free blocks available to unprivileged users.
7667+
Free blocks available to unprivileged users. Multiply by `statfs.bsize`
7668+
to get the value in bytes.
76687669
76697670
#### `statfs.bfree`
76707671
@@ -7676,7 +7677,9 @@ added:
76767677
76777678
* Type: {number|bigint}
76787679
7679-
Free blocks in file system.
7680+
Free blocks in file system. This includes blocks reserved for the
7681+
superuser that are not reported by `statfs.bavail`. Multiply by
7682+
`statfs.bsize` to get the value in bytes.
76807683
76817684
#### `statfs.blocks`
76827685
@@ -7688,7 +7691,8 @@ added:
76887691
76897692
* Type: {number|bigint}
76907693
7691-
Total data blocks in file system.
7694+
Total data blocks in file system. Multiply by `statfs.bsize` to get
7695+
the total size in bytes.
76927696
76937697
#### `statfs.bsize`
76947698
@@ -7700,7 +7704,8 @@ added:
77007704
77017705
* Type: {number|bigint}
77027706
7703-
Optimal transfer block size.
7707+
Optimal transfer block size in bytes. This value is also the unit for
7708+
the `statfs.blocks`, `statfs.bfree`, and `statfs.bavail` fields.
77047709
77057710
#### `statfs.ffree`
77067711
@@ -7712,7 +7717,7 @@ added:
77127717
77137718
* Type: {number|bigint}
77147719
7715-
Free file nodes in file system.
7720+
Free file nodes (inodes) in file system.
77167721
77177722
#### `statfs.files`
77187723
@@ -7724,7 +7729,7 @@ added:
77247729
77257730
* Type: {number|bigint}
77267731
7727-
Total file nodes in file system.
7732+
Total file nodes (inodes) in file system.
77287733
77297734
#### `statfs.type`
77307735
@@ -7736,7 +7741,11 @@ added:
77367741
77377742
* Type: {number|bigint}
77387743
7739-
Type of file system.
7744+
File system type as a numeric identifier. On Linux this is the
7745+
file system magic number (e.g. `0xef53` for ext2/ext3/ext4,
7746+
`0x01021994` for tmpfs). On other platforms the value is
7747+
OS-dependent. See the `statfs(2)` man page on Linux or `statfs(2)`
7748+
on macOS for platform-specific values.
77407749
77417750
### Class: `fs.Utf8Stream`
77427751

0 commit comments

Comments
 (0)