# libtmux.Server.save_buffer

- **Module:** libtmux.Server
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/036c521c4b83ce6e434eb50afe2a0d08a6a05e46/src/libtmux/server.py#L1899
- **Page:** https://libtmux.org/reference/py/libtmux-server-save_buffer/

```
libtmux.Server.save_buffer(self, path: StrPath, buffer_name: str | None = None, append: bool | None = None) -> None
```

Save a paste buffer to a file via ``$ tmux save-buffer``.

## Parameters

- `self`
- `path` (StrPath) — File path to save the buffer to.
- `buffer_name` (str | None) — Name of the buffer (``-b`` flag). Defaults to the most recent.
- `append` (bool | None) — Append to the file instead of overwriting (``-a`` flag).

## Example

```python
>>> import pathlib
>>> server.set_buffer('save_me')
>>> path = pathlib.Path(request.config.rootdir) / '..' / 'tmp_save.txt'
>>> server.save_buffer(str(path))
```
