ssh_download
Download files from a remote host to a local path via SFTP with atomic writes and configurable size limits to ensure safe, truncated-file-free transfers.
Instructions
Download a file from the remote host to a local path via SFTP. Binary-safe.
Writes to <local_path>.partial first, then atomically replaces the final path on success. A failed or cancelled download never leaves a truncated file where downstream tooling would pick it up.
Size cap: max_bytes (default 100 MiB, hard ceiling 1 GiB). Remote size is checked via sftp.stat BEFORE the transfer starts; files that exceed the cap fail fast. Caps are enforced streaming-side too, so a misreported remote size can't trick us into filling the local disk.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| remote_path | Yes | Absolute path to the file on the remote host. Tilde expansion is NOT performed (paramiko's SFTP doesn't know about the remote user's ``$HOME``). | |
| local_path | Yes | Where to write the file locally. Parent directories are created automatically. | |
| host | No | Alias of the configured host, or a raw address. | |
| max_bytes | No | Hard cap. Default 100 MiB, clamped to 1 GiB. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||