# tmux.Server.SaveBufferTo

- **Module:** tmux.Server
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-go/blob/52968a3181c1c9e6d1b26c565d4b170968ae61c0/tmux/server_buffers.go#L259
- **Page:** https://libtmux.org/en/go/latest/reference/tmux-server-savebufferto/

```
tmux.Server.SaveBufferTo(ctx: context.Context, destination: io.Writer, options: SaveBufferToOptions) -> error
```

SaveBufferTo streams a named or most-recent tmux paste buffer into destination without holding its contents in memory. It writes any bytes, including NUL, and preserves them exactly where [Server.ShowBuffer] reconstructs lines.

Cancellation does not prove destination received a complete buffer, and a
copy failure takes precedence over a completed command's exit status because
it means destination never saw everything tmux sent. A destination that
blocks regardless of cancellation does not hold the call. A
[Connection]-bound Server returns [ErrConnectionRequiresProcess]: tmux
offers no stdout to a control client, so use [Server.SaveBuffer] and a path
over a connection.
