diff --git a/doc/api/fs.md b/doc/api/fs.md index 7ae55fdd64d214..904ce4e1415988 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -7509,6 +7509,19 @@ added: Free blocks available to unprivileged users. +**Example:** +```javascript +import { statfs } from "fs/promises"; + +async function getAvailableSpace(path) { + const stats = await statfs(path); + const availableSpace = stats.bsize * stats.bavail; // available space in bytes + console.log(`Available space: ${availableSpace} bytes`); +} + +getAvailableSpace("/tmp"); +``` + #### `statfs.bfree`