# tmux.Pane.CaptureToBuffer

- **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#L152
- **Page:** https://libtmux.org/en/go/latest/reference/tmux-pane-capturetobuffer/

```
tmux.Pane.CaptureToBuffer(ctx: context.Context, buffer: string, request: CapturePaneRequest) -> error
```

CaptureToBuffer captures content from the receiver's exact linked pane into the nonempty named tmux buffer. The buffer is owned by tmux and no printed output is returned. A completed nonzero exit or stderr becomes a [CommandError].

Invalid requests fail before execution. Transport and context errors are
delivery-ambiguous: the buffer may already have changed.
