@@ -7929,7 +7929,26 @@ added:
79297929
79307930* Type: {number|bigint}
79317931
7932- Free blocks available to unprivileged users.
7932+ Free blocks available to unprivileged users. Multiply by [` statfs .bsize ` ][]
7933+ to get the number of available bytes.
7934+
7935+ ` ` ` mjs
7936+ import { statfs } from ' node:fs/promises' ;
7937+
7938+ const stats = await statfs (' /' );
7939+ const availableBytes = stats .bsize * stats .bavail ;
7940+ console .log (` Available space: ${ availableBytes} bytes` );
7941+ ` ` `
7942+
7943+ ` ` ` cjs
7944+ const { statfs } = require (' node:fs/promises' );
7945+
7946+ (async () => {
7947+ const stats = await statfs (' /' );
7948+ const availableBytes = stats .bsize * stats .bavail ;
7949+ console .log (` Available space: ${ availableBytes} bytes` );
7950+ })();
7951+ ` ` `
79337952
79347953#### ` statfs .bfree `
79357954
@@ -7941,7 +7960,26 @@ added:
79417960
79427961* Type: {number|bigint}
79437962
7944- Free blocks in file system.
7963+ Free blocks in file system. Multiply by [` statfs .bsize ` ][] to get the number
7964+ of free bytes.
7965+
7966+ ` ` ` mjs
7967+ import { statfs } from ' node:fs/promises' ;
7968+
7969+ const stats = await statfs (' /' );
7970+ const freeBytes = stats .bsize * stats .bfree ;
7971+ console .log (` Free space: ${ freeBytes} bytes` );
7972+ ` ` `
7973+
7974+ ` ` ` cjs
7975+ const { statfs } = require (' node:fs/promises' );
7976+
7977+ (async () => {
7978+ const stats = await statfs (' /' );
7979+ const freeBytes = stats .bsize * stats .bfree ;
7980+ console .log (` Free space: ${ freeBytes} bytes` );
7981+ })();
7982+ ` ` `
79457983
79467984#### ` statfs .blocks `
79477985
@@ -7953,7 +7991,26 @@ added:
79537991
79547992* Type: {number|bigint}
79557993
7956- Total data blocks in file system.
7994+ Total data blocks in file system. Multiply by [` statfs .bsize ` ][] to get the
7995+ total size in bytes.
7996+
7997+ ` ` ` mjs
7998+ import { statfs } from ' node:fs/promises' ;
7999+
8000+ const stats = await statfs (' /' );
8001+ const totalBytes = stats .bsize * stats .blocks ;
8002+ console .log (` Total space: ${ totalBytes} bytes` );
8003+ ` ` `
8004+
8005+ ` ` ` cjs
8006+ const { statfs } = require (' node:fs/promises' );
8007+
8008+ (async () => {
8009+ const stats = await statfs (' /' );
8010+ const totalBytes = stats .bsize * stats .blocks ;
8011+ console .log (` Total space: ${ totalBytes} bytes` );
8012+ })();
8013+ ` ` `
79578014
79588015#### ` statfs .bsize `
79598016
@@ -7965,7 +8022,7 @@ added:
79658022
79668023* Type: {number|bigint}
79678024
7968- Optimal transfer block size.
8025+ Optimal transfer block size in bytes .
79698026
79708027#### ` statfs .frsize `
79718028
@@ -8011,7 +8068,11 @@ added:
80118068
80128069* Type: {number|bigint}
80138070
8014- Type of file system.
8071+ Type of file system. A platform-specific numeric identifier for the type of
8072+ file system. This value corresponds to the ` f_type` field returned by
8073+ ` statfs (2 )` on POSIX systems (for example, ` 0xEF53 ` for ext4 on Linux). Its
8074+ meaning is OS-dependent and is not guaranteed to be consistent across
8075+ platforms.
80158076
80168077### Class: ` fs .Utf8Stream `
80178078
@@ -9060,6 +9121,7 @@ the file contents.
90609121[` fsPromises .rm ()` ]: #fspromisesrmpath-options
90619122[` fsPromises .stat ()` ]: #fspromisesstatpath-options
90629123[` fsPromises .utimes ()` ]: #fspromisesutimespath-atime-mtime
9124+ [` statfs .bsize ` ]: #statfsbsize
90639125[` inotify (7 )` ]: https://man7.org/linux/man-pages/man7/inotify.7.html
90649126[` kqueue (2 )` ]: https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2
90659127[` minimatch` ]: https://github.com/isaacs/minimatch
0 commit comments