SCP
Single-file SCP upload and download. Helpers are a public extension SSHConnection on the Swift side — there is no separate SCPClient type. Swift-only; not exposed from SSHKitObjC.
Upload
try await connection.uploadFileWithSCP(
localURL: URL(fileURLWithPath: "/Users/me/release.zip"),
toRemotePath: "/srv/release.zip",
permissions: 0o644,
maximumSize: 64 * 1024 * 1024
)
Download
try await connection.downloadFileWithSCP(
remotePath: "/srv/release.zip",
toLocalURL: URL(fileURLWithPath: "/Users/me/release.zip"),
maximumSize: 64 * 1024 * 1024
)
Limits
- Single regular files only. SCP recursion, archive flags, and preserve-times are not exposed.
maximumSizeguards both the local read (upload) and the remote header (download). Defaults to 64 MiB. Bump it deliberately for known-large payloads.- Remote paths are validated to reject empty strings, control characters, and leading
-(which SCP would interpret as a flag). - For directories, large files, progress callbacks, or resumable transfers, use SFTP instead.