---
title: OutputChunk
description: Output bytes, with the offset they start at.
---

```python
@final
class OutputChunk
```

Output bytes, with the offset they start at.

`data` is `bytes` and not `str`: exec output is arbitrary bytes, and a decode here
would be a lossy step the caller cannot see. `end` is where a cursor resumes.

## Constructor

`OutputChunk` declares no `__new__` or `__init__`, so it is not constructed directly: an instance comes back from another call in this package.

## Properties

### `data`

```python
data: bytes
```

### `end`

```python
end: int
```

One past this chunk's last byte: `offset + len(data)`.

### `kind`

```python
kind: str
```

`"output"` — the tag beside `isinstance`, so a caller can branch either way.

### `offset`

```python
offset: int
```

### `stream`

```python
stream: str
```

`"stdout"` or `"stderr"`. Both share one offset space, so a caller holds one
cursor rather than two that can disagree about ordering.

## Methods

### `text`

```python
def text() -> str
```

The bytes as text, replacing anything undecodable.

A method rather than a getter on `data`, so the lossy step is a call a reader sees
— the same reasoning as the core's `break_even_seconds_f64`.

## Special methods

### `__repr__`

```python
def __repr__() -> str
```

## Provenance

This page is generated from `bindings/microvms-py/microvms.pyi` by Griffe 2.3.0, run from `site/scripts/gen-reference.mjs` on every `pnpm run sync`, so an edit made here is overwritten by the next run.

To change the page, change the doc comment in the binding's Rust source, then regenerate the declarations with `mise run stubs`. `mise run stubs:check` fails when the committed file no longer matches the source.