Skip to content

Commit 849f530

Browse files
committed
doc: improve fs.StatFs property documentation
Fixes #50749 - statfs.bsize: clarify the unit is bytes (not bits) - statfs.bavail: add example showing how to calculate available size in bytes (bsize * bavail) - statfs.bfree: add example showing how to calculate free size in bytes (bsize * bfree) - statfs.type: explain that it is a numeric filesystem identifier and provide common examples (ext4, FAT)
1 parent 1ddb754 commit 849f530

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

doc/api/fs.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8002,7 +8002,8 @@ added:
80028002
80038003
* Type: {number|bigint}
80048004
8005-
Free blocks available to unprivileged users.
8005+
Free blocks available to unprivileged users. Multiply by `statfs.bsize` to get
8006+
the available size in bytes: `statfs.bsize * statfs.bavail`.
80068007
80078008
#### `statfs.bfree`
80088009
@@ -8014,7 +8015,8 @@ added:
80148015
80158016
* Type: {number|bigint}
80168017
8017-
Free blocks in file system.
8018+
Free blocks in the file system. Multiply by `statfs.bsize` to get
8019+
the free size in bytes: `statfs.bsize * statfs.bfree`.
80188020
80198021
#### `statfs.blocks`
80208022
@@ -8038,7 +8040,8 @@ added:
80388040
80398041
* Type: {number|bigint}
80408042
8041-
Optimal transfer block size.
8043+
Optimal transfer block size **in bytes**. Multiply this by block counts
8044+
(e.g., `statfs.bavail` or `statfs.bfree`) to calculate sizes in bytes.
80428045
80438046
#### `statfs.frsize`
80448047
@@ -8086,7 +8089,10 @@ added:
80868089
80878090
* Type: {number|bigint}
80888091
8089-
Type of file system.
8092+
Type of file system. The value is a numeric identifier corresponding to the
8093+
file system type (e.g., `0xEF53` for ext4, `0x4D44` for FAT). These values
8094+
are platform-specific and derived from the `f_type` field of `statvfs`/`statfs`
8095+
on POSIX systems, or equivalent platform APIs.
80908096
80918097
### Class: `fs.Utf8Stream`
80928098

0 commit comments

Comments
 (0)