@@ -7929,7 +7929,16 @@ added:
79297929
79307930* Type: {number|bigint}
79317931
7932- Free blocks available to unprivileged users.
7932+ Free blocks available to unprivileged users. Each block is ` statfs .bsize `
7933+ bytes. To calculate the available space in bytes:
7934+
7935+ ` ` ` mjs
7936+ import { statfs } from ' node:fs/promises' ;
7937+
7938+ const stats = await statfs (' /' );
7939+ const availableBytes = stats .bavail * stats .bsize ;
7940+ console .log (` Available space: ${ availableBytes / (1024 ** 3 )} GiB` );
7941+ ` ` `
79337942
79347943#### ` statfs .bfree `
79357944
@@ -7941,7 +7950,18 @@ added:
79417950
79427951* Type: {number|bigint}
79437952
7944- Free blocks in file system.
7953+ Free blocks in file system. This includes blocks reserved for the root user,
7954+ unlike ` statfs .bavail ` which only counts blocks available to unprivileged
7955+ users. Each block is ` statfs .bsize ` bytes. To calculate total free space in
7956+ bytes:
7957+
7958+ ` ` ` mjs
7959+ import { statfs } from ' node:fs/promises' ;
7960+
7961+ const stats = await statfs (' /' );
7962+ const freeBytes = stats .bfree * stats .bsize ;
7963+ console .log (` Free space: ${ freeBytes / (1024 ** 3 )} GiB` );
7964+ ` ` `
79457965
79467966#### ` statfs .blocks `
79477967
@@ -7953,7 +7973,16 @@ added:
79537973
79547974* Type: {number|bigint}
79557975
7956- Total data blocks in file system.
7976+ Total data blocks in file system. Each block is ` statfs .bsize ` bytes. To
7977+ calculate total disk size in bytes:
7978+
7979+ ` ` ` mjs
7980+ import { statfs } from ' node:fs/promises' ;
7981+
7982+ const stats = await statfs (' /' );
7983+ const totalBytes = stats .blocks * stats .bsize ;
7984+ console .log (` Total size: ${ totalBytes / (1024 ** 3 )} GiB` );
7985+ ` ` `
79577986
79587987#### ` statfs .bsize `
79597988
@@ -7965,7 +7994,7 @@ added:
79657994
79667995* Type: {number|bigint}
79677996
7968- Optimal transfer block size.
7997+ Optimal transfer block size, in bytes .
79697998
79707999#### ` statfs .frsize `
79718000
@@ -7975,7 +8004,8 @@ added: REPLACEME
79758004
79768005* Type: {number|bigint}
79778006
7978- Fundamental file system block size.
8007+ Fundamental file system block size, in bytes. On most POSIX systems this value
8008+ is equal to ` statfs .bsize ` .
79798009
79808010#### ` statfs .ffree `
79818011
@@ -7987,7 +8017,8 @@ added:
79878017
79888018* Type: {number|bigint}
79898019
7990- Free file nodes in file system.
8020+ Free file nodes (inodes) in file system. This is the number of additional files
8021+ that can be created on the file system.
79918022
79928023#### ` statfs .files `
79938024
@@ -7999,7 +8030,8 @@ added:
79998030
80008031* Type: {number|bigint}
80018032
8002- Total file nodes in file system.
8033+ Total file nodes (inodes) in file system. This represents the maximum number
8034+ of files the file system can hold.
80038035
80048036#### ` statfs .type `
80058037
@@ -8011,7 +8043,11 @@ added:
80118043
80128044* Type: {number|bigint}
80138045
8014- Type of file system.
8046+ Type of file system. This is a magic number defined by the operating system
8047+ that identifies the file system format (e.g. ` 0xEF53 ` for ext4,
8048+ ` 0x01021994 ` for tmpfs on Linux). On Windows this value corresponds to the
8049+ volume serial number. The values are platform-specific and should not be
8050+ relied upon for portable code.
80158051
80168052### Class: ` fs .Utf8Stream `
80178053
0 commit comments