@@ -7938,6 +7938,16 @@ added:
79387938
79397939Free blocks available to unprivileged users.
79407940
7941+ Example using ` bsize` and ` bavail` to calculate available space in bytes:
7942+
7943+ ` ` ` js
7944+ import { statfs } from " fs/promises" ;
7945+
7946+ const stats = await statfs (" /tmp" );
7947+ const availableBytes = stats .bsize * stats .bavail ;
7948+ console .log (` Available space: ${ availableBytes} bytes` );
7949+ ` ` `
7950+
79417951#### ` statfs .bfree `
79427952
79437953<!-- YAML
@@ -7950,6 +7960,16 @@ added:
79507960
79517961Free blocks in file system.
79527962
7963+ Example using ` bsize` and ` bfree` to calculate total free space in bytes:
7964+
7965+ ` ` ` js
7966+ import { statfs } from " fs/promises" ;
7967+
7968+ const stats = await statfs (" /tmp" );
7969+ const freeBytes = stats .bsize * stats .bfree ;
7970+ console .log (` Free space: ${ freeBytes} bytes` );
7971+ ` ` `
7972+
79537973#### ` statfs .blocks `
79547974
79557975<!-- YAML
@@ -7962,6 +7982,16 @@ added:
79627982
79637983Total data blocks in file system.
79647984
7985+ Example using ` bsize` and ` blocks` to calculate total file system size in bytes:
7986+
7987+ ` ` ` js
7988+ import { statfs } from " fs/promises" ;
7989+
7990+ const stats = await statfs (" /tmp" );
7991+ const totalBytes = stats .bsize * stats .blocks ;
7992+ console .log (` Total size: ${ totalBytes} bytes` );
7993+ ` ` `
7994+
79657995#### ` statfs .bsize `
79667996
79677997<!-- YAML
@@ -7972,7 +8002,7 @@ added:
79728002
79738003* Type: {number|bigint}
79748004
7975- Optimal transfer block size.
8005+ Optimal transfer block size, in **bytes** .
79768006
79778007#### ` statfs .frsize `
79788008
@@ -8006,7 +8036,7 @@ added:
80068036
80078037* Type: {number|bigint}
80088038
8009- Total file nodes in file system.
8039+ Total file nodes (inodes) in file system.
80108040
80118041#### ` statfs .type `
80128042
@@ -8018,7 +8048,10 @@ added:
80188048
80198049* Type: {number|bigint}
80208050
8021- Type of file system.
8051+ File system type identifier. The value corresponds to the ` f_type` field
8052+ from the underlying ` statfs` system call (e.g., ` 0x1021994 ` for ` ext2` ,
8053+ ` 0x4d44 ` for ` vfat` ). Platform-specific constants like ` FStype .EXT2 `
8054+ may be used for comparison when available.
80228055
80238056### Class: ` fs .Utf8Stream `
80248057
0 commit comments