Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7938,6 +7938,16 @@ added:

Free blocks available to unprivileged users.

Example using `bsize` and `bavail` to calculate available space in bytes:

```js
import { statfs } from "fs/promises";

const stats = await statfs("/tmp");
const availableBytes = stats.bsize * stats.bavail;
console.log(`Available space: ${availableBytes} bytes`);
```

#### `statfs.bfree`

<!-- YAML
Expand All @@ -7950,6 +7960,16 @@ added:

Free blocks in file system.

Example using `bsize` and `bfree` to calculate total free space in bytes:

```js
import { statfs } from "fs/promises";

const stats = await statfs("/tmp");
const freeBytes = stats.bsize * stats.bfree;
console.log(`Free space: ${freeBytes} bytes`);
```

#### `statfs.blocks`

<!-- YAML
Expand All @@ -7962,6 +7982,16 @@ added:

Total data blocks in file system.

Example using `bsize` and `blocks` to calculate total file system size in bytes:

```js
import { statfs } from "fs/promises";

const stats = await statfs("/tmp");
const totalBytes = stats.bsize * stats.blocks;
console.log(`Total size: ${totalBytes} bytes`);
```

#### `statfs.bsize`

<!-- YAML
Expand All @@ -7972,7 +8002,7 @@ added:

* Type: {number|bigint}

Optimal transfer block size.
Optimal transfer block size, in **bytes**.

#### `statfs.frsize`

Expand Down Expand Up @@ -8006,7 +8036,7 @@ added:

* Type: {number|bigint}

Total file nodes in file system.
Total file nodes (inodes) in file system.

#### `statfs.type`

Expand All @@ -8018,7 +8048,10 @@ added:

* Type: {number|bigint}

Type of file system.
File system type identifier. The value corresponds to the `f_type` field
from the underlying `statfs` system call (e.g., `0x1021994` for `ext2`,
`0x4d44` for `vfat`). Platform-specific constants like `FStype.EXT2`
may be used for comparison when available.

### Class: `fs.Utf8Stream`

Expand Down
Loading