---
title: "FileInfo | Grafana k6 documentation"
description: "FileInfo represents information about a file."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# FileInfo

The `FileInfo` class represents information about a [file](/docs/k6/latest/javascript-api/k6-experimental/fs/file/).

## Properties

Expand table

| Property | Type   | Description                    |
|----------|--------|--------------------------------|
| name     | string | The name of the file.          |
| size     | number | The size of the file in bytes. |

## Example

JavaScript ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
import { open, SeekMode } from 'k6/experimental/fs';

const file = await open('bonjour.txt');

export default async function () {
  // Retrieve information about the file
  const fileinfo = await file.stat();
  if (fileinfo.name != 'bonjour.txt') {
    throw new Error('Unexpected file name');
  }
}
```
