Skip to content

ClientOptions (transfer settings)

Every client object exposes an Options field that controls transfer behaviour, versioning, on-the-fly encryption, and connection timeout. All settings are optional (the defaults are sensible for most use cases).

ts
cli.Options.<field> = <value>;

Transfer behaviour

FieldTypeDefaultDescription
StopOnTransferErrorboolfalseAbort the entire batch on the first transfer failure. When false, the client continues and reports the overall result.
DownloadPolicyintNeverOverwriteWhat to do when a local file with the same name already exists. Use the transfer-policy constants.
UploadPolicyintNeverOverwriteWhat to do when a remote file with the same name already exists. Same constants as DownloadPolicy.
OnDownloadGrantTostring""POSIX username to chown every downloaded file to. Effective only on Linux when ss-wrk runs as root.
AdjustTimeOnDownloadbooltrueSet the downloaded file's modification time to match the remote file's mtime.
AdjustTimeOnUploadbooltrueSet the remote file's modification time to match the local file's mtime.
DownloadWithTempNameboolfalseDownload to <filename>.tempfile, rename to the final name only on successful completion. Prevents readers from seeing partial files.
UploadWithTempNameboolfalseUpload as <filename>.tempfile, rename to the final name only on successful completion.
DeleteSourceAfterDownloadboolfalseDelete the remote file after a successful download (effectively a remote → local move).
DeleteSourceAfterUploadboolfalseDelete the local file after a successful upload (effectively a local → remote move).

Versioning

When versioning is enabled, the existing file is moved to a .ver/ subdirectory before it is overwritten, keeping a configurable number of historical copies.

FieldTypeDefaultDescription
VersionedDownloadboolfalseMove an existing local file to a .ver/ subdirectory before overwriting it.
VersionedUploadboolfalseMove an existing remote file to a .ver/ subdirectory before overwriting it.
VersionsToKeepLocalint3Maximum number of versions to retain in the local .ver/ directory. Older copies are pruned automatically.
VersionsToKeepRemoteint3Maximum number of versions to retain in the remote .ver/ directory.

On-The-Fly Encryption (OTFE)

OTFE encrypts files transparently during upload and decrypts them during download. Encryption and decryption happen in memory, the remote side only ever stores the ciphertext, while the local side always sees plaintext.

FieldTypeDefaultDescription
OTFEboolfalseEnable OTFE for all upload and download operations.
OTFEAlgorithmintOTFEAlgoAES256GCMEncryption algorithm. Use the OTFE constants.
OTFEKeystring""Passphrase / key material. For AES-256-GCM, fed into PBKDF2-SHA256 to derive a 32-byte key. For OpenPGP, used as the symmetric passphrase (RFC 4880 S2K).

TIP

Avoid storing encryption keys directly in scripts. Use GetSecret to fetch the key at runtime:

ts
cli.Options.OTFE         = true;
cli.Options.OTFEAlgorithm = OTFEAlgoAES256GCM;
cli.Options.OTFEKey      = GetSecret("transfer-encryption-key");

See the Secrets page for how to define secrets in the Admin UI, and the GetSecret reference for usage details.


Connection

FieldTypeDefaultDescription
ConnectTimeoutSecondsint30TCP dial timeout in seconds. 0 means no timeout. Not used by the object-storage clients (S3, Azure, GCS), which manage their own connection timeouts internally via their SDK HTTP clients.