---
title: "stat | Grafana k6 documentation"
description: "stat returns a promise resolving to a FileInfo object with information about the file."
---

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

# stat

The `stat` method returns a promise resolving to a [FileInfo](/docs/k6/latest/javascript-api/k6-experimental/fs/fileinfo/) object with information about the file.

## Returns

A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) resolving to a [FileInfo](/docs/k6/latest/javascript-api/k6-experimental/fs/fileinfo/) object with information about the file.

## Examples

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 () {
  // About information about the file
  const fileinfo = await file.stat();
  if (fileinfo.name != 'bonjour.txt') {
    throw new Error('Unexpected file name');
  }

  console.log(JSON.stringify(fileinfo));
}
```
