# tmux.Pane.CaptureTo

- **Module:** tmux.Pane
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-go/blob/52968a3181c1c9e6d1b26c565d4b170968ae61c0/tmux/pane_capture.go#L388
- **Page:** https://libtmux.org/en/go/latest/reference/tmux-pane-captureto/

```
tmux.Pane.CaptureTo(ctx: context.Context, destination: io.Writer, request: CapturePaneRequest) -> error
```

CaptureTo streams printed content from the receiver's exact linked pane into destination without holding a screen in memory, which is what makes a long scrollback affordable to write straight to a file or a compressor. Like [Pane.Capture] it reads the screen at one point in time rather than following it; the zero request reads the visible screen and version-gated fields follow [UnsupportedPolicy].

A completed nonzero exit becomes a redacted command error, because CaptureTo
returns no bytes for the caller to inspect. Cancellation does not prove
destination received the complete screen, and a copy failure takes
precedence over a completed command's exit status because it means
destination never saw everything tmux sent. Printed captures always use a
subprocess, so a [Connection]-bound Pane returns
[ErrConnectionRequiresProcess]; [Pane.CaptureToFile] stages through a tmux
buffer and runs over a connection.
