@@ -7804,7 +7804,26 @@ added:
78047804
78057805* Type: {number|bigint}
78067806
7807- Free blocks available to unprivileged users.
7807+ Free blocks available to unprivileged users. Multiply by [` statfs .bsize ` ][]
7808+ to get the number of available bytes.
7809+
7810+ ` ` ` mjs
7811+ import { statfs } from ' node:fs/promises' ;
7812+
7813+ const stats = await statfs (' /' );
7814+ const availableBytes = stats .bsize * stats .bavail ;
7815+ console .log (` Available space: ${ availableBytes} bytes` );
7816+ ` ` `
7817+
7818+ ` ` ` cjs
7819+ const { statfs } = require (' node:fs/promises' );
7820+
7821+ (async () => {
7822+ const stats = await statfs (' /' );
7823+ const availableBytes = stats .bsize * stats .bavail ;
7824+ console .log (` Available space: ${ availableBytes} bytes` );
7825+ })();
7826+ ` ` `
78087827
78097828#### ` statfs .bfree `
78107829
@@ -7816,7 +7835,26 @@ added:
78167835
78177836* Type: {number|bigint}
78187837
7819- Free blocks in file system.
7838+ Free blocks in file system. Multiply by [` statfs .bsize ` ][] to get the number
7839+ of free bytes.
7840+
7841+ ` ` ` mjs
7842+ import { statfs } from ' node:fs/promises' ;
7843+
7844+ const stats = await statfs (' /' );
7845+ const freeBytes = stats .bsize * stats .bfree ;
7846+ console .log (` Free space: ${ freeBytes} bytes` );
7847+ ` ` `
7848+
7849+ ` ` ` cjs
7850+ const { statfs } = require (' node:fs/promises' );
7851+
7852+ (async () => {
7853+ const stats = await statfs (' /' );
7854+ const freeBytes = stats .bsize * stats .bfree ;
7855+ console .log (` Free space: ${ freeBytes} bytes` );
7856+ })();
7857+ ` ` `
78207858
78217859#### ` statfs .blocks `
78227860
@@ -7828,7 +7866,26 @@ added:
78287866
78297867* Type: {number|bigint}
78307868
7831- Total data blocks in file system.
7869+ Total data blocks in file system. Multiply by [` statfs .bsize ` ][] to get the
7870+ total size in bytes.
7871+
7872+ ` ` ` mjs
7873+ import { statfs } from ' node:fs/promises' ;
7874+
7875+ const stats = await statfs (' /' );
7876+ const totalBytes = stats .bsize * stats .blocks ;
7877+ console .log (` Total space: ${ totalBytes} bytes` );
7878+ ` ` `
7879+
7880+ ` ` ` cjs
7881+ const { statfs } = require (' node:fs/promises' );
7882+
7883+ (async () => {
7884+ const stats = await statfs (' /' );
7885+ const totalBytes = stats .bsize * stats .blocks ;
7886+ console .log (` Total space: ${ totalBytes} bytes` );
7887+ })();
7888+ ` ` `
78327889
78337890#### ` statfs .bsize `
78347891
@@ -7840,7 +7897,7 @@ added:
78407897
78417898* Type: {number|bigint}
78427899
7843- Optimal transfer block size.
7900+ Optimal transfer block size in bytes .
78447901
78457902#### ` statfs .frsize `
78467903
@@ -7886,7 +7943,11 @@ added:
78867943
78877944* Type: {number|bigint}
78887945
7889- Type of file system.
7946+ Type of file system. A platform-specific numeric identifier for the type of
7947+ file system. This value corresponds to the ` f_type` field returned by
7948+ ` statfs (2 )` on POSIX systems (for example, ` 0xEF53 ` for ext4 on Linux). Its
7949+ meaning is OS-dependent and is not guaranteed to be consistent across
7950+ platforms.
78907951
78917952### Class: ` fs .Utf8Stream `
78927953
@@ -8937,6 +8998,7 @@ the file contents.
89378998[` inotify (7 )` ]: https://man7.org/linux/man-pages/man7/inotify.7.html
89388999[` kqueue (2 )` ]: https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2
89399000[` minimatch` ]: https://github.com/isaacs/minimatch
9001+ [` statfs .bsize ` ]: #statfsbsize
89409002[` util .promisify ()` ]: util.md#utilpromisifyoriginal
89419003[bigints]: https://tc39.github.io/proposal-bigint
89429004[caveats]: #caveats
0 commit comments